pub struct DocumentSymbol {
pub name: String,
pub kind: SymbolKind,
pub full_span: Span,
pub name_span: Span,
pub children: Vec<DocumentSymbol>,
}Expand description
A symbol in the document symbol outline (for IDE sidebar).
Fields§
§name: StringThe name of the symbol.
kind: SymbolKindThe kind of symbol.
full_span: SpanThe span of the entire declaration.
name_span: SpanThe span of just the name.
children: Vec<DocumentSymbol>Child symbols (e.g. structure fields, inductive constructors).
Implementations§
Source§impl DocumentSymbol
impl DocumentSymbol
Sourcepub fn new(
name: String,
kind: SymbolKind,
full_span: Span,
name_span: Span,
) -> Self
pub fn new( name: String, kind: SymbolKind, full_span: Span, name_span: Span, ) -> Self
Create a new document symbol.
Sourcepub fn add_child(&mut self, child: DocumentSymbol)
pub fn add_child(&mut self, child: DocumentSymbol)
Add a child symbol.
Sourcepub fn has_children(&self) -> bool
pub fn has_children(&self) -> bool
Whether this symbol has children.
Sourcepub fn find_by_name(&self, name: &str) -> Option<&DocumentSymbol>
pub fn find_by_name(&self, name: &str) -> Option<&DocumentSymbol>
Recursively find a symbol by name.
Sourcepub fn flatten(&self) -> Vec<&DocumentSymbol>
pub fn flatten(&self) -> Vec<&DocumentSymbol>
Flatten into a list (self first, then children recursively).
Trait Implementations§
Source§impl Clone for DocumentSymbol
impl Clone for DocumentSymbol
Source§fn clone(&self) -> DocumentSymbol
fn clone(&self) -> DocumentSymbol
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DocumentSymbol
impl Debug for DocumentSymbol
Source§impl PartialEq for DocumentSymbol
impl PartialEq for DocumentSymbol
impl StructuralPartialEq for DocumentSymbol
Auto Trait Implementations§
impl Freeze for DocumentSymbol
impl RefUnwindSafe for DocumentSymbol
impl Send for DocumentSymbol
impl Sync for DocumentSymbol
impl Unpin for DocumentSymbol
impl UnsafeUnpin for DocumentSymbol
impl UnwindSafe for DocumentSymbol
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