Skip to main content

DataValue

Enum DataValue 

Source
pub enum DataValue {
    Definition {
        base: Option<ParentType>,
        constraints: Option<Vec<Constraint>>,
        value: Option<Value>,
        list: Option<InstanceListBody>,
    },
    Import {
        spec_ref: SpecRef,
        bindings: Vec<UsesBinding>,
        effective_ref: Option<Reference>,
        global: bool,
    },
    ImportList {
        spec_ref: SpecRef,
        list: InstanceListBody,
    },
    OwnRows {
        spec_ref: SpecRef,
        bindings: Vec<UsesBinding>,
    },
}
Expand description

Parse-time data value (before type resolution)

Variants§

§

Definition

Declares data: optional explicit parent type, optional constraints (-> ...), optional literal value, and optional instance-list body (-> key / -> with rows).

Examples:

  • data x: 3.14 → base: None, value: Some(Number)
  • data x: number -> minimum 0 → base: Some(Number), constraints: Some(...)
  • data x: finance.money → base: Some(Qualified { spec_alias: "finance", inner: Custom("money") })
  • data staff: employee list -> with name: "Ada" → base: Some(List { … }), list: Some(…)

Value-list rows stay in constraints (money list -> with 89 eur). Instance-list -> key and field / named-instance rows live in list.

Fields

§constraints: Option<Vec<Constraint>>
§value: Option<Value>
§

Import

Import from another spec (surface syntax is uses; alias is LemmaData::reference). effective_ref is -> effective <ref> on the uses block; mutually exclusive with a trailing literal pin on SpecRef::effective. global is uses global: the slot reads the declaring repository’s one instance of the target in an evaluation. Its bindings write on that instance.

Fields

§spec_ref: SpecRef
§bindings: Vec<UsesBinding>
§effective_ref: Option<Reference>
§global: bool
§

ImportList

uses names one spec. A list after that target is a parse error, so planning never sees this variant. It stays so matches stay exhaustive with the published type.

Fields

§spec_ref: SpecRef
§

OwnRows

uses x -> with f: v inside spec x, which holds a list of its own rows (data xs: x list): what the spec writes on those rows. It is no instance; planning rejects it.

Fields

§spec_ref: SpecRef
§bindings: Vec<UsesBinding>

Implementations§

Source§

impl DataValue

Source

pub fn import(spec_ref: SpecRef) -> Self

Source

pub fn is_definition_literal_only(&self) -> bool

Whether this is only a literal RHS (data x: 3.14), valid as a binding value.

Source

pub fn definition_needs_type_resolution(&self) -> bool

Whether planning must resolve this LemmaData row through the type resolver / named types.

Spec-element instance lists (list: Some or empty spec list) are planned via add_instance_list, not the named-type registry.

Source

pub fn uses_spec_ref(&self) -> Option<&SpecRef>

Spec named by a uses alias. Types and units read through the alias the same way.

Trait Implementations§

Source§

impl Clone for DataValue

Source§

fn clone(&self) -> Self

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 DataValue

Source§

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

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

impl PartialEq for DataValue

Source§

fn eq(&self, other: &Self) -> 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 DataValue

Auto Trait Implementations§

§

impl Forget for DataValue

§

impl Freeze for DataValue

§

impl Move for DataValue

§

impl RefUnwindSafe for DataValue

§

impl Send for DataValue
where RawVecInner: Send, BoxRaw<ParentType>: Send, BoxRaw<Value>: Send, Arc<PathBuf>: Send,

§

impl Sync for DataValue
where RawVecInner: Sync, BoxRaw<ParentType>: Sync, BoxRaw<Value>: Sync, Arc<PathBuf>: Sync,

§

impl Unpin for DataValue
where *const u8 is !null: Unpin, Box<ParentType>: Unpin, Box<Value>: Unpin, Arc<PathBuf>: Unpin,

§

impl UnsafeUnpin for DataValue

§

impl UnwindSafe for DataValue
where RawVecInner: UnwindSafe, BoxRaw<ParentType>: UnwindSafe, BoxRaw<Value>: UnwindSafe, Arc<PathBuf>: UnwindSafe,

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.