pub struct DocumentNode { /* private fields */ }Expand description
Typed document CST wrapper.
Args: None.
Returns: Stable accessors for top-level syntax items and spans.
Implementations§
Source§impl DocumentNode
impl DocumentNode
Sourcepub fn cast(syntax: SyntaxNode) -> Option<Self>
pub fn cast(syntax: SyntaxNode) -> Option<Self>
Casts a raw rowan node into a typed document wrapper.
Args: syntax: Raw rowan syntax node.
Returns:
Typed document wrapper when the kind matches Document.
Sourcepub fn syntax(&self) -> &SyntaxNode
pub fn syntax(&self) -> &SyntaxNode
Returns the raw rowan node.
Args: None.
Returns: Borrowed raw syntax node.
Sourcepub fn range(&self) -> TextRange
pub fn range(&self) -> TextRange
Returns the document text range.
Args: None.
Returns: Full document range in source text coordinates.
Sourcepub fn directives(&self) -> impl Iterator<Item = DirectiveNode> + '_
pub fn directives(&self) -> impl Iterator<Item = DirectiveNode> + '_
Iterates directive children.
Args: None.
Returns: Typed directive iterator.
Sourcepub fn doc_comments(&self) -> impl Iterator<Item = DocCommentNode> + '_
pub fn doc_comments(&self) -> impl Iterator<Item = DocCommentNode> + '_
Iterates doc-comment children.
Args: None.
Returns: Typed doc-comment iterator.
Sourcepub fn namespaces(&self) -> impl Iterator<Item = NamespaceNode> + '_
pub fn namespaces(&self) -> impl Iterator<Item = NamespaceNode> + '_
Iterates namespace children.
Args: None.
Returns: Typed namespace iterator.
Trait Implementations§
Source§impl Clone for DocumentNode
impl Clone for DocumentNode
Source§fn clone(&self) -> DocumentNode
fn clone(&self) -> DocumentNode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DocumentNode
impl !RefUnwindSafe for DocumentNode
impl !Send for DocumentNode
impl !Sync for DocumentNode
impl Unpin for DocumentNode
impl UnsafeUnpin for DocumentNode
impl !UnwindSafe for DocumentNode
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