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
impl SystemStateSchema
Sourcepub fn load_json_template(path: &Path) -> Result<Self, StateError>
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:
StateError::TemplateReadwhen the file cannot be read;StateError::TemplateParsewhen JSON syntax or structure is invalid;StateError::EmptyFieldNamefor an empty normalized field name;StateError::DuplicateFieldfor repeated normalized names.
Sourcepub fn create_empty_state(&self, time: StateTime) -> SystemState
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
impl Clone for SystemStateSchema
Source§fn clone(&self) -> SystemStateSchema
fn clone(&self) -> SystemStateSchema
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 SystemStateSchema
impl Debug for SystemStateSchema
Source§impl StateSchemaAccess for SystemStateSchema
impl StateSchemaAccess for SystemStateSchema
Source§fn template_path(&self) -> &Path
fn template_path(&self) -> &Path
Source§fn field_schemas(&self) -> &[StateFieldSchema]
fn field_schemas(&self) -> &[StateFieldSchema]
Source§fn field_schema(&self, name: &str) -> Option<&StateFieldSchema>
fn field_schema(&self, name: &str) -> Option<&StateFieldSchema>
Source§fn contains_field(&self, name: &str) -> bool
fn contains_field(&self, name: &str) -> bool
name.Auto Trait Implementations§
impl Freeze for SystemStateSchema
impl RefUnwindSafe for SystemStateSchema
impl Send for SystemStateSchema
impl Sync for SystemStateSchema
impl Unpin for SystemStateSchema
impl UnsafeUnpin for SystemStateSchema
impl UnwindSafe for SystemStateSchema
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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