Skip to main content

FragmentDef

Struct FragmentDef 

Source
pub struct FragmentDef {
    pub name: String,
    pub file: String,
    pub span: Option<Span>,
    pub source: Arc<str>,
    pub placeholders: Vec<String>,
    pub supplied_variables: Vec<String>,
}
Expand description

A fragment definition — the go-to-definition target for a ref:, and the vocabulary a ref: line completes against.

Fields§

§name: String

Fragment name (globally unique across the scanned files).

§file: String

Source name of the file declaring it.

§span: Option<Span>

Byte span of its # @proef annotation line, when locatable — the landing anchor.

§source: Arc<str>

The exact text span was measured against. Carried rather than re-read: a consumer converting the span needs a line index built from these bytes, and a fresh read could observe a newer edit and mis-anchor.

§placeholders: Vec<String>

Every variable the entry reads, in first-seen order — exactly the names a bind: in scope has to supply (ADR-0018).

Read off the engine’s own AST at scan time, so an editor offering them is offering the file’s real interface rather than a second description of it that could disagree. Without this the only way to learn a foreign corpus’s variable names is to run the suite and read proef::lower::unbound_placeholder.

Faithful to what the entry reads, so subtract Self::supplied_variables before offering these as bind: keys.

§supplied_variables: Vec<String>

Every variable the entry supplies to itself ([Options] variable:).

A name here needs no bind: and may not have one (proef::pack::option_declared_twice), so an editor offering it as a completion would be proposing an edit its own diagnostics then reject.

Trait Implementations§

Source§

impl Clone for FragmentDef

Source§

fn clone(&self) -> FragmentDef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FragmentDef

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.