Skip to main content

Decl

Struct Decl 

Source
pub struct Decl {
    pub parent: Option<usize>,
    pub construct: &'static str,
    pub name: Option<String>,
    pub traits: &'static [&'static str],
    pub kind: String,
    pub span: (usize, usize),
    pub lines: (usize, usize),
    pub signature: Option<String>,
    pub doc: Option<String>,
    pub callee: Option<String>,
    pub n_params: Option<i64>,
}
Expand description

One lowered construct — the code level’s producer seam, the parallel of quarb_text::Block. A producer emits Decls in pre-order (a parent precedes its children); CodeModel::build derives the arbor. The tree-sitter producer lives in this crate; another backend supplies the same stream and nothing above it moves.

Fields§

§parent: Option<usize>

Index of the parent Decl, or None for a top-level one.

§construct: &'static str

The vocabulary word: function, type, if, call, …

§name: Option<String>

The declared (or adopted) identifier, where one exists.

§traits: &'static [&'static str]

Curated trait set — never backend kinds.

§kind: String

The raw backend kind; surfaces only as ::::kind.

§span: (usize, usize)

Byte range into the source.

§lines: (usize, usize)

1-based start/end lines.

§signature: Option<String>

The declaration head, whitespace-collapsed (::signature).

§doc: Option<String>

Attached documentation, markers stripped (::doc).

§callee: Option<String>

A call’s callee text (::callee).

§n_params: Option<i64>

Declared parameter count, functions only (::::n-params).

Trait Implementations§

Source§

impl Debug for Decl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Decl

§

impl RefUnwindSafe for Decl

§

impl Send for Decl

§

impl Sync for Decl

§

impl Unpin for Decl

§

impl UnsafeUnpin for Decl

§

impl UnwindSafe for Decl

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.