Skip to main content

StructRef

Type Alias StructRef 

Source
pub type StructRef<'a> = MaybeImported<&'a Struct, &'a ImportedStruct>;
Expand description

A reference to a struct in the document’s scope.

Aliased Type§

pub enum StructRef<'a> {
    Local(&'a Struct),
    Imported(&'a ImportedStruct),
}

Variants§

§

Local(&'a Struct)

The item is locally defined.

§

Imported(&'a ImportedStruct)

The item was imported from another document.

Implementations§

Source§

impl<'a> StructRef<'a>

Source

pub fn name(&self) -> &'a str

Gets the name of the struct.

Source

pub fn name_span(&self) -> Span

Gets the span of the name.

Source

pub fn ty(&self) -> Option<&'a Type>

Gets the type of the struct, if it was computed.

Source

pub fn source(&self) -> Option<Arc<Url>>

Gets the source of the struct, if it was imported.

Source

pub fn definition(&self) -> StructDefinition

Reconstructs the AST definition from the stored green node.

Source

pub fn offset(&self) -> usize

Gets the offset of the struct in the source document’s CST.

Source

pub fn node(&self) -> &'a GreenNode

Gets the node of the struct.