Struct rune::ast::ExprSelect[][src]

pub struct ExprSelect {
    pub attributes: Vec<Attribute>,
    pub select: Select,
    pub open: OpenBrace,
    pub branches: Vec<(ExprSelectBranch, Option<Comma>)>,
    pub close: CloseBrace,
}

A select expression that selects over a collection of futures.

Examples

use rune::{testing, ast};

let select = testing::roundtrip::<ast::ExprSelect>(r#"
select {
    _ = a => 0,
    _ = b => {},
    _ = c => {}
    default => ()
}
"#);

assert_eq!(4, select.branches.len());
assert!(matches!(select.branches.get(1), Some(&(ast::ExprSelectBranch::Pat(..), Some(..)))));
assert!(matches!(select.branches.get(2), Some(&(ast::ExprSelectBranch::Pat(..), None))));
assert!(matches!(select.branches.get(3), Some(&(ast::ExprSelectBranch::Default(..), None))));

Fields

attributes: Vec<Attribute>

The attributes of the select

select: Select

The select keyword.

open: OpenBrace

The open brace.

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

The branches of the select.

close: CloseBrace

The close brace.

Implementations

impl ExprSelect[src]

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

Parse the select expression and attach the given attributes

Trait Implementations

impl Clone for ExprSelect[src]

impl Debug for ExprSelect[src]

impl Eq for ExprSelect[src]

impl Parse for ExprSelect[src]

impl PartialEq<ExprSelect> for ExprSelect[src]

impl Spanned for ExprSelect[src]

impl StructuralEq for ExprSelect[src]

impl StructuralPartialEq for ExprSelect[src]

impl ToTokens for ExprSelect[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.