Skip to main content

ScannedFragment

Struct ScannedFragment 

Source
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: String

The 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: String

The entry’s own source text, annotation included (provenance survives into the artifact).

§line: usize

1-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 nametoken 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

Source§

fn clone(&self) -> ScannedFragment

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 ScannedFragment

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for ScannedFragment

Source§

impl PartialEq for ScannedFragment

Source§

fn eq(&self, other: &ScannedFragment) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ScannedFragment

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.