pub trait SyntaxNode {
// Provided methods
fn span(&self) -> Option<Span> { ... }
fn ident(&self) -> Option<Ident> { ... }
fn attributes(&self) -> &[AttributeNode] ⓘ { ... }
fn attributes_mut(&mut self) -> &mut [AttributeNode] ⓘ { ... }
fn contains_attribute(&self, attribute: &Attribute) -> bool { ... }
fn retain_attributes_mut<F>(&mut self, _predicate: F)
where F: FnMut(&mut Attribute) -> bool { ... }
}Expand description
Trait implemented for all syntax node types.
This trait is useful for generic implementations over different syntax node types.
Node types that do not have a span, an ident, or attributes return None.
Provided Methods§
Sourcefn attributes(&self) -> &[AttributeNode] ⓘ
fn attributes(&self) -> &[AttributeNode] ⓘ
List all attributes of a syntax node.
Sourcefn attributes_mut(&mut self) -> &mut [AttributeNode] ⓘ
fn attributes_mut(&mut self) -> &mut [AttributeNode] ⓘ
List all attributes of a syntax node.
Sourcefn contains_attribute(&self, attribute: &Attribute) -> bool
fn contains_attribute(&self, attribute: &Attribute) -> bool
Whether the node contains an attribute.
Sourcefn retain_attributes_mut<F>(&mut self, _predicate: F)
fn retain_attributes_mut<F>(&mut self, _predicate: F)
Remove attributes with predicate.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.