pub struct Directive(/* private fields */);Expand description
#name <body> form. Body shape depends on the directive’s
name; the typed-AST layer reads it from Directive::name.
Implementations§
Source§impl Directive
impl Directive
Sourcepub fn cast(node: SyntaxNode) -> Option<Self>
pub fn cast(node: SyntaxNode) -> Option<Self>
Wrap node if its SyntaxKind matches; otherwise
return None. O(1) — just a kind check.
Sourcepub fn syntax(&self) -> &SyntaxNode
pub fn syntax(&self) -> &SyntaxNode
Borrow the underlying SyntaxNode. Useful for
downstream traversals that want CST-level access.
Source§impl Directive
impl Directive
Sourcepub fn name(&self) -> Option<String>
pub fn name(&self) -> Option<String>
Directive name (everything after the #). None when the
parser emitted an ERROR before the name was captured.
Sourcepub fn body_exprs(&self) -> impl Iterator<Item = Expr> + '_
pub fn body_exprs(&self) -> impl Iterator<Item = Expr> + '_
Direct-child expression(s) of the directive body. For
#schema X { ... } this yields the body dict; for
#default 0 it yields the value expression. The number of
items is shape-dependent and the typed-AST layer above this
crate decides interpretation.
Trait Implementations§
impl Eq for Directive
impl StructuralPartialEq for Directive
Auto Trait Implementations§
impl !RefUnwindSafe for Directive
impl !Send for Directive
impl !Sync for Directive
impl !UnwindSafe for Directive
impl Freeze for Directive
impl Unpin for Directive
impl UnsafeUnpin for Directive
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