Minimal Imperative Parsing Library | https://docs.rs/mipl

add docs for the `Delimiter` trait

ecsolticia.codeberg.page 2e64c84e 1a9e3304

verified
+6
+6
src/lexer/delimiter.rs
··· 6 fn new_with_inner(v: HashSet<char>) -> Self; 7 fn inner(&self) -> &HashSet<char>; 8 } 9 pub trait Delimiters: Inner + Sized { 10 fn new(vec: Vec<char>) -> Self { 11 Self::new_with_inner( 12 HashSet::from_iter(vec.iter().cloned()) 13 ) 14 } 15 16 fn contains(&self, ch: char) -> bool { 17 self.inner().contains(&ch) 18 }
··· 6 fn new_with_inner(v: HashSet<char>) -> Self; 7 fn inner(&self) -> &HashSet<char>; 8 } 9 + /// The interface of [DiscardDelimiters] and 10 + /// [KeepDelimiters]. 11 pub trait Delimiters: Inner + Sized { 12 + /// Construct a new set of delimiters from 13 + /// a list of characters. 14 fn new(vec: Vec<char>) -> Self { 15 Self::new_with_inner( 16 HashSet::from_iter(vec.iter().cloned()) 17 ) 18 } 19 20 + /// Check if the set of delimiters contains a 21 + /// particular delimiter character. 22 fn contains(&self, ch: char) -> bool { 23 self.inner().contains(&ch) 24 }