Struct pex::BracketPattern
source · pub struct BracketPattern {
pub open: &'static str,
pub close: &'static str,
pub delimiter: &'static str,
pub dangling: Option<bool>,
pub one_tailing: bool,
}Expand description
A bracket pattern like [] or (1, )
Fields§
§open: &'static strThe open bracket pattern
close: &'static strThe close bracket pattern
delimiter: &'static strThe delimiter of the bracket elements
dangling: Option<bool>Whether the last element can be dangling
one_tailing: boolNeed add delimiter if there is only one element
Implementations§
source§impl BracketPattern
impl BracketPattern
sourcepub fn with_delimiter(self, delimiter: &'static str) -> Self
pub fn with_delimiter(self, delimiter: &'static str) -> Self
Create a new bracket pattern
sourcepub fn with_dangling(self, dangling: bool) -> Self
pub fn with_dangling(self, dangling: bool) -> Self
Create a new bracket pattern
sourcepub fn with_one_tailing(self, one_tailing: bool) -> Self
pub fn with_one_tailing(self, one_tailing: bool) -> Self
Create a new bracket pattern
source§impl BracketPattern
impl BracketPattern
sourcepub fn consume<'i, F, I, T, U>(
&self,
input: ParseState<'i>,
ignore: I,
parser: F
) -> ParseResult<'i, BracketPair<'i, T>>where
F: FnMut(ParseState<'i>) -> ParseResult<'i, T> + Copy,
I: FnMut(ParseState<'i>) -> ParseResult<'i, U> + Copy,
pub fn consume<'i, F, I, T, U>( &self, input: ParseState<'i>, ignore: I, parser: F ) -> ParseResult<'i, BracketPair<'i, T>>where F: FnMut(ParseState<'i>) -> ParseResult<'i, T> + Copy, I: FnMut(ParseState<'i>) -> ParseResult<'i, U> + Copy,
[ ~ ]
[ ~ term (~ , ~ term)* (~ ,)? ~ ]
<| a, b, c |>
Trait Implementations§
source§impl Clone for BracketPattern
impl Clone for BracketPattern
source§fn clone(&self) -> BracketPattern
fn clone(&self) -> BracketPattern
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for BracketPattern
impl Debug for BracketPattern
impl Copy for BracketPattern
Auto Trait Implementations§
impl RefUnwindSafe for BracketPattern
impl Send for BracketPattern
impl Sync for BracketPattern
impl Unpin for BracketPattern
impl UnwindSafe for BracketPattern
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more