pub struct UseTree { /* private fields */ }Implementations§
Source§impl UseTree
impl UseTree
Sourcepub fn path_segments(&self) -> impl Iterator<Item = SyntaxToken> + '_
pub fn path_segments(&self) -> impl Iterator<Item = SyntaxToken> + '_
The leading dotted/::-separated path segments, in order —
use_tree’s grammar lays these out as bare IDENT tokens
interspersed with :: directly inside USE_TREE (no nested PATH
node, unlike import’s path), so this walks direct-child tokens up
to (not including) an as-alias or a nested { … } list.
Sourcepub fn alias_token(&self) -> Option<SyntaxToken>
pub fn alias_token(&self) -> Option<SyntaxToken>
The as alias name, if this tree ends in one.
Sourcepub fn nested_list(&self) -> Option<UseTreeList>
pub fn nested_list(&self) -> Option<UseTreeList>
The nested { a, b as c, … } group, if this tree has one.
Trait Implementations§
Source§impl AstNode for UseTree
impl AstNode for UseTree
Source§fn can_cast(kind: SyntaxKind) -> bool
fn can_cast(kind: SyntaxKind) -> bool
Returns
true for a node with a SyntaxKind this type can wrap.Source§fn cast(node: SyntaxNode) -> Option<Self>
fn cast(node: SyntaxNode) -> Option<Self>
Try to cast a generic
SyntaxNode into this typed wrapper.Source§fn syntax(&self) -> &SyntaxNode
fn syntax(&self) -> &SyntaxNode
Access the underlying
SyntaxNode.impl Eq for UseTree
impl StructuralPartialEq for UseTree
Auto Trait Implementations§
impl !RefUnwindSafe for UseTree
impl !Send for UseTree
impl !Sync for UseTree
impl !UnwindSafe for UseTree
impl Freeze for UseTree
impl Unpin for UseTree
impl UnsafeUnpin for UseTree
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