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 str

The open bracket pattern

§close: &'static str

The close bracket pattern

§delimiter: &'static str

The delimiter of the bracket elements

§dangling: Option<bool>

Whether the last element can be dangling

§one_tailing: bool

Need add delimiter if there is only one element

Implementations§

source§

impl BracketPattern

source

pub fn new(open: &'static str, close: &'static str) -> Self

Create a new bracket pattern

source

pub fn with_delimiter(self, delimiter: &'static str) -> Self

Create a new bracket pattern

source

pub fn with_dangling(self, dangling: bool) -> Self

Create a new bracket pattern

source

pub fn with_one_tailing(self, one_tailing: bool) -> Self

Create a new bracket pattern

source§

impl BracketPattern

source

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

source§

fn clone(&self) -> BracketPattern

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BracketPattern

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for BracketPattern

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.