Struct rune::ast::ExprMatch[][src]

pub struct ExprMatch {
    pub attributes: Vec<Attribute>,
    pub match_: Match,
    pub expr: Expr,
    pub open: OpenBrace,
    pub branches: Vec<(ExprMatchBranch, Option<Comma>)>,
    pub close: CloseBrace,
}

A match expression.

Examples

use rune::{testing, ast};

testing::roundtrip::<ast::ExprMatch>("match 0 { _ => 1, }");
let expr = testing::roundtrip::<ast::ExprMatch>("#[jit(always)] match 0 { _ => 1, }");
assert_eq!(expr.attributes.len(), 1);

Fields

attributes: Vec<Attribute>

The attributes for the match expression

match_: Match

The match token.

expr: Expr

The expression who’s result we match over.

open: OpenBrace

The open brace of the match.

branches: Vec<(ExprMatchBranch, Option<Comma>)>

Branches.

close: CloseBrace

The close brace of the match.

Implementations

impl ExprMatch[src]

pub fn parse_with_attributes(
    parser: &mut Parser<'_>,
    attributes: Vec<Attribute>
) -> Result<Self, ParseError>
[src]

Parse the match expression attaching the given attributes

Trait Implementations

impl Clone for ExprMatch[src]

impl Debug for ExprMatch[src]

impl Eq for ExprMatch[src]

impl Parse for ExprMatch[src]

impl PartialEq<ExprMatch> for ExprMatch[src]

impl Spanned for ExprMatch[src]

impl StructuralEq for ExprMatch[src]

impl StructuralPartialEq for ExprMatch[src]

impl ToTokens for ExprMatch[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.