pub struct LambdaExpr { /* private fields */ }Implementations§
Source§impl LambdaExpr
impl LambdaExpr
Sourcepub fn params(&self) -> Option<LambdaParams>
pub fn params(&self) -> Option<LambdaParams>
The |…| parameter row (issue #1685). None only for a malformed
node — parser/expr.rs::lambda_expr always opens with one, even for
the zero-arg || form (whose row is simply empty).
Sourcepub fn return_annotation(&self) -> Option<TypeAnnotation>
pub fn return_annotation(&self) -> Option<TypeAnnotation>
The : type return annotation (|g|: bool { … }), if written.
Unambiguous as a direct child: a parameter’s own annotation lives
inside that parameter’s PARAM node, itself inside LAMBDA_PARAMS,
so the only TYPE_ANNOTATION directly under LAMBDA_EXPR is the
return one.
Sourcepub fn body(&self) -> Option<SyntaxNode>
pub fn body(&self) -> Option<SyntaxNode>
The body’s root node — the single expression (|g| g.awake) or the
braced STMT_BLOCK (|g|: bool { … }). The last child, since the
parser emits params, then the optional return annotation, then the
body.
Trait Implementations§
Source§impl AstNode for LambdaExpr
impl AstNode for LambdaExpr
Source§fn can_cast(kind: SyntaxKind) -> bool
fn can_cast(kind: SyntaxKind) -> bool
Returns
true for a node with a SyntaxKind this type can wrap.Source§fn cast(node: SyntaxNode) -> Option<Self>
fn cast(node: SyntaxNode) -> Option<Self>
Try to cast a generic
SyntaxNode into this typed wrapper.Source§fn syntax(&self) -> &SyntaxNode
fn syntax(&self) -> &SyntaxNode
Access the underlying
SyntaxNode.Source§impl Clone for LambdaExpr
impl Clone for LambdaExpr
Source§fn clone(&self) -> LambdaExpr
fn clone(&self) -> LambdaExpr
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LambdaExpr
impl Debug for LambdaExpr
Source§impl Display for LambdaExpr
impl Display for LambdaExpr
impl Eq for LambdaExpr
Source§impl Hash for LambdaExpr
impl Hash for LambdaExpr
Source§impl PartialEq for LambdaExpr
impl PartialEq for LambdaExpr
impl StructuralPartialEq for LambdaExpr
Auto Trait Implementations§
impl !RefUnwindSafe for LambdaExpr
impl !Send for LambdaExpr
impl !Sync for LambdaExpr
impl !UnwindSafe for LambdaExpr
impl Freeze for LambdaExpr
impl Unpin for LambdaExpr
impl UnsafeUnpin for LambdaExpr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more