pub trait Freezable {
// Provided methods
fn freeze<E>(&self, encoder: &mut E) -> Result<(), EncodeError>
where E: Encoder { ... }
fn thaw<D>(&mut self, decoder: &mut D) -> Result<(), DecodeError>
where D: Decoder { ... }
}
Expand description
The internal state of a task needs to be serializable so the framework can take a snapshop of the task graph.
Provided Methods§
Sourcefn freeze<E>(&self, encoder: &mut E) -> Result<(), EncodeError>where
E: Encoder,
fn freeze<E>(&self, encoder: &mut E) -> Result<(), EncodeError>where
E: Encoder,
This method is called by the framework when it wants to save the task state. The default implementation is to encode nothing (stateless). If you have a state, you need to implement this method.
Sourcefn thaw<D>(&mut self, decoder: &mut D) -> Result<(), DecodeError>where
D: Decoder,
fn thaw<D>(&mut self, decoder: &mut D) -> Result<(), DecodeError>where
D: Decoder,
This method is called by the framework when it wants to restore the task to a specific state. Here it is similar to Decode but the framework will give you a new instance of the task (the new method will be called)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.