pub struct TypeNode(/* private fields */);Implementations§
Source§impl TypeNode
impl TypeNode
Sourcepub fn cast(node: SyntaxNode) -> Option<Self>
pub fn cast(node: SyntaxNode) -> Option<Self>
Wrap node if its SyntaxKind matches; otherwise
return None. O(1) — just a kind check.
Sourcepub fn syntax(&self) -> &SyntaxNode
pub fn syntax(&self) -> &SyntaxNode
Borrow the underlying SyntaxNode. Useful for
downstream traversals that want CST-level access.
Source§impl TypeNode
impl TypeNode
Sourcepub fn path_text(&self) -> Vec<String>
pub fn path_text(&self) -> Vec<String>
Path segments — Foo / Foo.Bar / "foo".Bar. Returns the
raw text of each IDENT / STRING token preceding the first
generic / ?.
Sourcepub fn generics(&self) -> impl Iterator<Item = TypeNode> + '_
pub fn generics(&self) -> impl Iterator<Item = TypeNode> + '_
Direct-child TYPE_NODEs nested inside this one’s generic argument list.
Sourcepub fn is_optional(&self) -> bool
pub fn is_optional(&self) -> bool
Foo? — true when the trailing ? is present.
Trait Implementations§
impl Eq for TypeNode
impl StructuralPartialEq for TypeNode
Auto Trait Implementations§
impl !RefUnwindSafe for TypeNode
impl !Send for TypeNode
impl !Sync for TypeNode
impl !UnwindSafe for TypeNode
impl Freeze for TypeNode
impl Unpin for TypeNode
impl UnsafeUnpin for TypeNode
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