Skip to main content

LeafedInterfaceDeclaration

Struct LeafedInterfaceDeclaration 

Source
pub struct LeafedInterfaceDeclaration<ConfigType, List: Copy> { /* private fields */ }
Expand description

A serialized UI declaration paired with a leaf-config type list for replay.

The List type parameter is a phantom LeafConfigList chain that determines which leaf config types are tried when deserializing LeafConfig instructions. It is not serialized to disk; callers must supply the same list at load time.

Implementations§

Source§

impl<ConfigType, List: Copy> LeafedInterfaceDeclaration<ConfigType, List>

Source

pub fn new( serialized: SerializedInterfaceDeclaration<ConfigType>, leaf_types: List, ) -> Self

Creates a declaration from a serialized stream and a leaf type list.

Source

pub fn start(&mut self)

Records a Start marker.

Source

pub fn end(&mut self)

Records an End marker.

Source

pub fn open(&mut self)

Records an Open instruction.

Source

pub fn add_config(&mut self, config: ConfigType)

Records a Configure instruction.

Source

pub fn close(&mut self)

Records a Close instruction.

Source

pub fn add_leaf_config<LeafConfig: Serialize>(&mut self, config: &LeafConfig)

Records a LeafConfig instruction.

Source

pub fn iter_over( &self, ) -> impl Iterator<Item = LeafedInterfaceInstructions<&SerializableInterfaceInstructions<ConfigType>, List>>

Iterates instructions paired with the leaf type list for replay.

Source§

impl<ConfigType: Serialize + DeserializeOwned, List: Copy> LeafedInterfaceDeclaration<ConfigType, List>

Source

pub fn store_in(&self, file: &Path) -> Result<(), Box<dyn Error>>

Serializes the instruction stream to a JSON file.

Only the instruction vector is written; the leaf type list is not persisted.

§Errors

Returns an error if JSON serialization or file writing fails.

Source

pub fn load_from(file: &Path, leaf_types: List) -> Result<Self, Box<dyn Error>>

Loads an instruction stream from a JSON file.

The caller must supply the same LeafConfigList type chain that was used during recording.

§Errors

Returns an error if file reading or JSON deserialization fails.

Trait Implementations§

Source§

impl<'inside, Configurer: ConfigureElements<ConfigType>, ConfigType: Clone, List: Copy + LeafConfigListCompatible<Configurer, ConfigType>> UiFn<'inside, Configurer, ConfigType> for &LeafedInterfaceDeclaration<ConfigType, List>

Source§

fn draw_in( self, layout: &mut ConfiguredParentElement<'inside, Configurer, ConfigType>, )

Replays the stored declaration into the layout root (stage 2 of the debug pipeline).

Interprets the instruction stream to rebuild the element tree without debug wrappers.

§Panics

Panics if the instruction stream is invalid:

  • "Bad replay: cannot configure ConfiguredParentElement"Configure at parent scope.
  • "Bad replay: cannot configure ConfiguredParentElement with leaf config"LeafConfig at parent scope.

Auto Trait Implementations§

§

impl<ConfigType, List> Freeze for LeafedInterfaceDeclaration<ConfigType, List>
where List: Freeze,

§

impl<ConfigType, List> RefUnwindSafe for LeafedInterfaceDeclaration<ConfigType, List>
where List: RefUnwindSafe, ConfigType: RefUnwindSafe,

§

impl<ConfigType, List> Send for LeafedInterfaceDeclaration<ConfigType, List>
where List: Send, ConfigType: Send,

§

impl<ConfigType, List> Sync for LeafedInterfaceDeclaration<ConfigType, List>
where List: Sync, ConfigType: Sync,

§

impl<ConfigType, List> Unpin for LeafedInterfaceDeclaration<ConfigType, List>
where List: Unpin, ConfigType: Unpin,

§

impl<ConfigType, List> UnsafeUnpin for LeafedInterfaceDeclaration<ConfigType, List>
where List: UnsafeUnpin,

§

impl<ConfigType, List> UnwindSafe for LeafedInterfaceDeclaration<ConfigType, List>
where List: UnwindSafe, ConfigType: 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> 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, 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.