Struct rune::ast::ExprClosure [−][src]
A closure expression.
Examples
use rune::{testing, ast}; testing::roundtrip::<ast::ExprClosure>("async || 42"); testing::roundtrip::<ast::ExprClosure>("|| 42"); testing::roundtrip::<ast::ExprClosure>("|| { 42 }"); testing::roundtrip::<ast::ExprClosure>("move || { 42 }"); testing::roundtrip::<ast::ExprClosure>("async move || { 42 }"); let expr = testing::roundtrip::<ast::ExprClosure>("#[retry(n=3)] || 43"); assert_eq!(expr.attributes.len(), 1); let expr = testing::roundtrip::<ast::ExprClosure>("#[retry(n=3)] async || 43"); assert_eq!(expr.attributes.len(), 1);
Fields
id: Option<Id>
Opaque identifier for the closure.
attributes: Vec<Attribute>
The attributes for the async closure
async_token: Option<Async>
If the closure is async or not.
move_token: Option<Move>
If the closure moves data into it.
args: ExprClosureArgs
Arguments to the closure.
body: Expr
The body of the closure.
Implementations
impl ExprClosure
[src]
pub fn parse_with_meta(
parser: &mut Parser<'_>,
attributes: Vec<Attribute>,
async_token: Option<Async>,
move_token: Option<Move>
) -> Result<Self, ParseError>
[src]
parser: &mut Parser<'_>,
attributes: Vec<Attribute>,
async_token: Option<Async>,
move_token: Option<Move>
) -> Result<Self, ParseError>
Parse #ident and attach the given meta
impl ExprClosure
[src]
Trait Implementations
impl Clone for ExprClosure
[src]
fn clone(&self) -> ExprClosure
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ExprClosure
[src]
impl Eq for ExprClosure
[src]
impl Parse for ExprClosure
[src]
fn parse(p: &mut Parser<'_>) -> Result<Self, ParseError>
[src]
impl PartialEq<ExprClosure> for ExprClosure
[src]
fn eq(&self, other: &ExprClosure) -> bool
[src]
fn ne(&self, other: &ExprClosure) -> bool
[src]
impl Spanned for ExprClosure
[src]
impl StructuralEq for ExprClosure
[src]
impl StructuralPartialEq for ExprClosure
[src]
impl ToTokens for ExprClosure
[src]
fn to_tokens(&self, context: &MacroContext, stream: &mut TokenStream)
[src]
Auto Trait Implementations
impl RefUnwindSafe for ExprClosure
impl Send for ExprClosure
impl Sync for ExprClosure
impl Unpin for ExprClosure
impl UnwindSafe for ExprClosure
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,