BodyItems

Trait BodyItems 

Source
pub trait BodyItems {
    type Item;

    // Required method
    fn iter_items<'a>(
        &self,
        db: &'a dyn SyntaxGroup,
    ) -> impl Iterator<Item = Self::Item> + 'a;
}
Expand description

Trait for getting the items of a body-item (an item that contains items), as an iterator.

Required Associated Types§

Source

type Item

The type of an Item.

Required Methods§

Source

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

Returns the items of the body-item as an iterator. Use with caution, as this includes items that may be filtered out by plugins. Do note that plugins that directly run on this body-item without going/checking up on the syntax tree may assume that e.g. out-of-config items were already filtered out. Don’t use on an item that is not the original plugin’s context, unless you are sure that while traversing the AST to get to it from the original plugin’s context, you did not go through another submodule.

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§