pub struct DirectiveNode { /* private fields */ }Expand description
Typed directive CST wrapper.
Args: None.
Returns: Stable accessors for directive name, value and span.
Implementations§
Source§impl DirectiveNode
impl DirectiveNode
Sourcepub fn cast(syntax: SyntaxNode) -> Option<Self>
pub fn cast(syntax: SyntaxNode) -> Option<Self>
Casts a raw rowan node into a typed directive wrapper.
Args: syntax: Raw rowan syntax node.
Returns:
Typed directive wrapper when the kind matches Directive.
Sourcepub fn range(&self) -> TextRange
pub fn range(&self) -> TextRange
Returns the directive text range.
Args: None.
Returns: Directive range in source text coordinates.
Sourcepub fn keyword_range(&self) -> Option<TextRange>
pub fn keyword_range(&self) -> Option<TextRange>
Returns the directive keyword range including the leading !.
Args: None.
Returns:
Range covering a directive keyword such as !shell when present.
Sourcepub fn name(&self) -> Option<SmolStr>
pub fn name(&self) -> Option<SmolStr>
Returns the directive name token text without the leading !.
Args: None.
Returns: Directive name when present.
Sourcepub fn directive_kind(&self) -> Option<DirectiveKind>
pub fn directive_kind(&self) -> Option<DirectiveKind>
Returns the typed directive kind.
Sourcepub fn value(&self) -> Option<SmolStr>
pub fn value(&self) -> Option<SmolStr>
Returns the directive value text after the directive name.
Args: None.
Returns: Joined directive value text when present.
Sourcepub fn raw_value(&self) -> Option<SmolStr>
pub fn raw_value(&self) -> Option<SmolStr>
Returns the directive value with its original internal punctuation.
Sourcepub fn argument_name_range(&self) -> Option<TextRange>
pub fn argument_name_range(&self) -> Option<TextRange>
Returns the first identifier range after the directive name.
Trait Implementations§
Source§impl Clone for DirectiveNode
impl Clone for DirectiveNode
Source§fn clone(&self) -> DirectiveNode
fn clone(&self) -> DirectiveNode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more