Trait ra_ap_hir_def::item_tree::ItemTreeNode
source · pub trait ItemTreeNode: Clone {
type Source: AstNode + Into<Item>;
fn ast_id(&self) -> FileAstId<Self::Source>;
fn lookup(tree: &ItemTree, index: Idx<Self>) -> &Self;
fn id_from_mod_item(mod_item: ModItem) -> Option<FileItemTreeId<Self>>;
fn id_to_mod_item(id: FileItemTreeId<Self>) -> ModItem;
}
Expand description
Trait implemented by all item nodes in the item tree.
Required Associated Types§
Required Methods§
fn ast_id(&self) -> FileAstId<Self::Source>
sourcefn lookup(tree: &ItemTree, index: Idx<Self>) -> &Self
fn lookup(tree: &ItemTree, index: Idx<Self>) -> &Self
Looks up an instance of Self
in an item tree.
sourcefn id_from_mod_item(mod_item: ModItem) -> Option<FileItemTreeId<Self>>
fn id_from_mod_item(mod_item: ModItem) -> Option<FileItemTreeId<Self>>
Downcasts a ModItem
to a FileItemTreeId
specific to this type.
sourcefn id_to_mod_item(id: FileItemTreeId<Self>) -> ModItem
fn id_to_mod_item(id: FileItemTreeId<Self>) -> ModItem
Upcasts a FileItemTreeId
to a generic ModItem
.