Skip to main content

ValueState

Trait ValueState 

Source
pub trait ValueState: Send + 'static {
    // Required methods
    fn info(&self) -> &'static ValueInfo;
    fn write_state(&self, out: &mut OutStream<'_>) -> Sys<()>;
    fn read_state(&mut self, input: &mut InStream<'_>) -> Sys<()>;
    fn view(&self, ty: TypeId) -> Option<&dyn Any>;
    fn view_mut(&mut self, ty: TypeId) -> Option<&mut dyn Any>;
}
Expand description

The state of a valuetype instance: the struct the generator makes for each valuetype, with the state of its base type as a member.

Required Methods§

Source

fn info(&self) -> &'static ValueInfo

The type of the instance.

Source

fn write_state(&self, out: &mut OutStream<'_>) -> Sys<()>

Writes the state members, those of the base types first.

Source

fn read_state(&mut self, input: &mut InStream<'_>) -> Sys<()>

Reads the state members, those of the base types first.

Source

fn view(&self, ty: TypeId) -> Option<&dyn Any>

The state of the type ty (this type or a base type) in this one.

Source

fn view_mut(&mut self, ty: TypeId) -> Option<&mut dyn Any>

The same, to change.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§