pub struct ScannedFragment {
pub name: String,
pub text: String,
pub line: usize,
pub placeholders: Vec<String>,
pub declared_options: Vec<String>,
pub supplied_variables: Vec<String>,
}Expand description
One entry of a fragment file, as the claiming engine’s own parser sees it.
Engine-agnostic by construction: proef-core never learns a hurl type, and
a future engine fills the same shape from its own AST. Everything here is
read from the entry — nothing is declared separately and nothing can
therefore drift from the file.
Fields§
§name: StringThe name its # @proef <name> annotation gave it.
A scanner reports only annotated entries. An unannotated one is not a
fragment — nothing can ref: it — and a corpus proef did not write is
expected to be mostly those, so building them only to be discarded is
the bulk of a scan for no one’s benefit.
text: StringThe entry’s own source text, annotation included (provenance survives into the artifact).
line: usize1-based line the entry starts on, for diagnostics.
placeholders: Vec<String>Every variable the entry reads, in first-seen order — its required inputs.
declared_options: Vec<String>Option families the entry sets for itself, which a referencing step may
then not also set (proef::pack::option_declared_twice). A list rather
than one flag per option, so the core applies its general rule to
whatever it knows about and a new family costs no engine change.
Every element must be one of OPTION_FAMILIES — these strings are
matched against the pack’s own option keys, so a spelling only the engine
knows silences the check rather than failing it.
supplied_variables: Vec<String>Every variable the entry supplies to itself, in first-seen order — the
engine equivalent of a bind:, written into the fragment file.
Kept apart from Self::declared_options because the two clash on
different keys: an option family is a closed vocabulary compared
family-to-family, while a supplied variable is an open set compared
name to name — token clashes with a bind: of token and with
nothing else. Folding them together would make OPTION_FAMILIES’
“every element is one of these” invariant unstatable.
Both halves of this field are load-bearing. A name here satisfies a
placeholder of the same name (the fragment answers its own question, so
the file still runs standalone under the engine’s own binary — ADR-0018’s
premise), and it collides with a bind: of that name
(proef::pack::option_declared_twice), because the engine may resolve
the pair silently rather than refusing it.
Trait Implementations§
Source§impl Clone for ScannedFragment
impl Clone for ScannedFragment
Source§fn clone(&self) -> ScannedFragment
fn clone(&self) -> ScannedFragment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScannedFragment
impl Debug for ScannedFragment
impl Eq for ScannedFragment
Source§impl PartialEq for ScannedFragment
impl PartialEq for ScannedFragment
impl StructuralPartialEq for ScannedFragment
Auto Trait Implementations§
impl Freeze for ScannedFragment
impl RefUnwindSafe for ScannedFragment
impl Send for ScannedFragment
impl Sync for ScannedFragment
impl Unpin for ScannedFragment
impl UnsafeUnpin for ScannedFragment
impl UnwindSafe for ScannedFragment
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.