Match

Struct Match 

Source
pub struct Match<'source> {
    pub match_token: Token<'source>,
    pub expression: Option<Box<Expression<'source>>>,
    pub then_token: Option<Token<'source>>,
    pub end_token: Option<Token<'source>>,
    pub diagnostics: Diagnostics<'source>,
    pub cases: [MatchCase<'source>],
}

Fields§

§match_token: Token<'source>§expression: Option<Box<Expression<'source>>>§then_token: Option<Token<'source>>§end_token: Option<Token<'source>>§diagnostics: Diagnostics<'source>§cases: [MatchCase<'source>]

Implementations§

Source§

impl<'source> Match<'source>

Source

pub fn build<G>( match_token: Token<'source>, expression: Option<Box<Expression<'source>>>, then_token: Option<Token<'source>>, end_token: Option<Token<'source>>, diagnostics: Diagnostics<'source>, cases: G, ) -> Box<Self>
where G: IntoIterator<Item = MatchCase<'source>>, <G as IntoIterator>::IntoIter: ExactSizeIterator,

Creates an instance of Box<Match>.

Source

pub fn build_from_slice( match_token: Token<'source>, expression: Option<Box<Expression<'source>>>, then_token: Option<Token<'source>>, end_token: Option<Token<'source>>, diagnostics: Diagnostics<'source>, cases: &[MatchCase<'source>], ) -> Box<Self>
where MatchCase<'source>: Copy,

Creates an instance of Box<Match>.

Source

pub fn destructure( this: Box<Self>, ) -> (Token<'source>, Option<Box<Expression<'source>>>, Option<Token<'source>>, Option<Token<'source>>, Diagnostics<'source>, MatchIter<'source>)

Destructures an instance of Box<Match>, returning the tail slice as an iterator.

Source§

impl<'source> Match<'source>

Source

pub fn new(lexer: &mut Peekable<Lexer<'source>>) -> Box<Self>

§Panics

Panics if the lexer returns None.

This function should only be called after successfully peeking a Lexigram::Match.

Trait Implementations§

Source§

impl<'source> Debug for Match<'source>

Source§

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

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

impl<'source> PartialEq for Match<'source>

Source§

fn eq(&self, other: &Match<'source>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'source> Eq for Match<'source>

Source§

impl<'source> StructuralPartialEq for Match<'source>

Auto Trait Implementations§

§

impl<'source> Freeze for Match<'source>

§

impl<'source> RefUnwindSafe for Match<'source>

§

impl<'source> Send for Match<'source>

§

impl<'source> !Sized for Match<'source>

§

impl<'source> Sync for Match<'source>

§

impl<'source> Unpin for Match<'source>

§

impl<'source> UnwindSafe for Match<'source>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more