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: StringFragment name (globally unique across the scanned files).
file: StringSource 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
impl Clone for FragmentDef
Source§fn clone(&self) -> FragmentDef
fn clone(&self) -> FragmentDef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more