QueryAttrs

Trait QueryAttrs 

Source
pub trait QueryAttrs {
    // Provided methods
    fn attributes_elements<'a>(
        &self,
        db: &'a dyn SyntaxGroup,
    ) -> impl Iterator<Item = Attribute> + 'a { ... }
    fn query_attr<'a>(
        &self,
        db: &'a dyn SyntaxGroup,
        attr: &'a str,
    ) -> impl Iterator<Item = Attribute> + 'a { ... }
    fn find_attr(&self, db: &dyn SyntaxGroup, attr: &str) -> Option<Attribute> { ... }
    fn has_attr(&self, db: &dyn SyntaxGroup, attr: &str) -> bool { ... }
    fn has_attr_with_arg(
        &self,
        db: &dyn SyntaxGroup,
        attr_name: &str,
        arg_name: &str,
    ) -> bool { ... }
}
Expand description

Trait for querying attributes of AST items.

Provided Methods§

Source

fn attributes_elements<'a>( &self, db: &'a dyn SyntaxGroup, ) -> impl Iterator<Item = Attribute> + 'a

Generic call to self.attributes(db).elements(db).

Source

fn query_attr<'a>( &self, db: &'a dyn SyntaxGroup, attr: &'a str, ) -> impl Iterator<Item = Attribute> + 'a

Collect all attributes named exactly attr attached to this node.

Source

fn find_attr(&self, db: &dyn SyntaxGroup, attr: &str) -> Option<Attribute>

Find first attribute named exactly attr attached do this node.

Source

fn has_attr(&self, db: &dyn SyntaxGroup, attr: &str) -> bool

Check if this node has an attribute named exactly attr.

Source

fn has_attr_with_arg( &self, db: &dyn SyntaxGroup, attr_name: &str, arg_name: &str, ) -> bool

Checks if the given object has an attribute with the given name and argument.

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.

Implementors§