pub trait AstToken {
fn can_cast(from: SyntaxKind) -> bool
where
Self: Sized;
fn cast(from: SyntaxToken) -> Option<Self>
where
Self: Sized;
fn syntax(&self) -> &SyntaxToken;
}
Required Methods
fn can_cast(from: SyntaxKind) -> boolwhere
Self: Sized,
sourcefn cast(from: SyntaxToken) -> Option<Self>where
Self: Sized,
fn cast(from: SyntaxToken) -> Option<Self>where
Self: Sized,
Cast an untyped token into this strongly-typed token. This will return None if the type was not correct.