Skip to main content

NullDatamodel

Struct NullDatamodel 

Source
pub struct NullDatamodel;
Expand description

The null datamodel: no data, and only In('id') conditions. Every other condition, value expression, assignment, script and foreach is an evaluation error. Inline content (of <content>) is not an expression and is passed through as a string.

Implementations§

Source§

impl NullDatamodel

Source

pub fn new() -> Self

A new null datamodel.

Trait Implementations§

Source§

impl Clone for NullDatamodel

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 Copy for NullDatamodel

Source§

impl Datamodel for NullDatamodel

Source§

fn snapshot(&self) -> Value

The null datamodel has no state: its snapshot is the empty value (undefined).

Source§

fn name(&self) -> &str

The datamodel name as used in the datamodel attribute.
Source§

fn init_session(&mut self, _info: &SessionInfo) -> Result<(), EvalError>

Prepare a fresh session: set the system variables _sessionid, _name and _ioprocessors. Called once before any other operation.
Source§

fn set_environment(&mut self, _env: &Environment)

Set the sources of nondeterminism for the input about to be processed.
Source§

fn declare(&mut self, _id: &str) -> Result<(), EvalError>

Create a data item with an undefined value.
Source§

fn set_event(&mut self, _event: &Event)

Bind _event to the event currently being processed.
Source§

fn eval_cond( &mut self, expr: &str, states: &dyn StateQuery, ) -> Result<bool, EvalError>

Evaluate a condition. Must not change the datamodel ([[openspec:datamodel#Guard Purity]]).
Source§

fn eval_value( &mut self, _expr: &str, _states: &dyn StateQuery, ) -> Result<Value, EvalError>

Evaluate a value expression.
Source§

fn eval_content(&mut self, content: &str) -> Result<Value, EvalError>

Interpret inline content (of <data>, <assign>, <content>) as a value.
Source§

fn assign_expr( &mut self, _location: &str, _expr: &str, _states: &dyn StateQuery, ) -> Result<(), EvalError>

Assign the value of an expression to a location (<assign location expr>).
Source§

fn assign_value( &mut self, _location: &str, _value: Value, ) -> Result<(), EvalError>

Assign a value to a location. The location must already exist.
Source§

fn bind_var(&mut self, _name: &str, _value: Value) -> Result<(), EvalError>

Bind a variable, declaring it when it does not exist (used by foreach item and index).
Source§

fn is_location(&mut self, _location: &str) -> bool

Whether location is a legal, existing location (used by foreach and idlocation).
Source§

fn exec_script( &mut self, _script: &str, _states: &dyn StateQuery, ) -> Result<(), EvalError>

Execute a script.
Source§

fn foreach_items( &mut self, _array: &str, _states: &dyn StateQuery, ) -> Result<Vec<Value>, EvalError>

Evaluate a foreach array expression to its items, shallow-copied, in index order.
Source§

fn restore(&mut self, snapshot: &Value) -> Result<(), EvalError>

Restore a state produced by Datamodel::snapshot.
Source§

fn check_event(&self, _event: &Event) -> Result<(), EvalError>

Whether event’s payload has the type the chart declares for it. A datamodel without declared event types accepts every payload (the default). The interpreter does not call this: a host calls it, through admit, before it hands an event to the session.
Source§

impl Debug for NullDatamodel

Source§

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

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

impl Default for NullDatamodel

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for NullDatamodel

Source§

impl PartialEq for NullDatamodel

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 NullDatamodel

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> 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.