Skip to main content

SystemStateSchema

Struct SystemStateSchema 

Source
pub struct SystemStateSchema { /* private fields */ }
Expand description

A validated, shareable SystemState layout.

SystemStateSchema owns an Arc to immutable metadata, making Clone a cheap reference-count increment. Every state derived from a specification shares the exact field order and name lookup table.

Implementations§

Source§

impl SystemStateSchema

Source

pub fn load_json_template(path: &Path) -> Result<Self, StateError>

Loads and validates a state specification from a JSON template.

The file is read as bytes and parsed directly, avoiding an intermediate UTF-8 String allocation. The returned specification retains the input path for diagnostics and provenance but does not canonicalize it or keep the file open.

§Errors

Returns:

Source

pub fn create_empty_state(&self, time: StateTime) -> SystemState

Creates an empty SystemState that shares this specification.

Every declared field exists in the returned state’s layout, while every payload slot starts empty. Cloning the specification is constant-time and does not duplicate layout data.

Trait Implementations§

Source§

impl Clone for SystemStateSchema

Source§

fn clone(&self) -> SystemStateSchema

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 SystemStateSchema

Source§

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

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

impl StateSchemaAccess for SystemStateSchema

Source§

fn shares_schema_instance(&self, other: &SystemStateSchema) -> bool

Reports whether two schema handles share one immutable allocation. Read more
Source§

fn template_path(&self) -> &Path

Returns the path from which this schema was loaded.
Source§

fn field_schemas(&self) -> &[StateFieldSchema]

Returns field descriptions in deterministic template order.
Source§

fn field_schema(&self, name: &str) -> Option<&StateFieldSchema>

Looks up one field description by normalized name.
Source§

fn contains_field(&self, name: &str) -> bool

Reports whether the schema declares name.
Source§

fn len(&self) -> usize

Returns the number of declared fields.
Source§

fn is_empty(&self) -> bool

Reports whether the schema declares no fields.
Source§

fn to_json_template(&self) -> Result<String, Error>

Converts this schema to the strict, pretty-printed JSON template format.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, <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.