pub trait TransitionMetadata<Cur: Sandbox, Next: Sandbox> { }
Expand description
Metadata about an evolution or devolution. Any Sandbox
implementation
that also implements EvolvableSandbox
or DevolvableSandbox
can decide the following things in a type-safe way:
- That transition is possible
- That transition requires a specific kind of metadata
For example, if you have the following structs:
ⓘ
struct MySandbox1 {}
struct MySandbox2 {}
impl Sandbox for MySandbox1 {...}
impl Sandbox for MySandbox2 {...}
…then you can define a metadata-free evolve transition between
MySandbox1
and MySandbox2
, and a devolve transition that requires
a callback between MySandbox2
and MySandbox
as follows:
ⓘ
impl EvolvableSandbox<
MySandbox1,
MySandbox2,
Noop<MySandbox1, MySandbox2>
> for MySandbox1 {
fn evolve(
self,
_: Noop<MySandbox1, MySandbox2>
) -> Result<MySandbox2> {
Ok(MySandbox2{})
}
}
Most transitions will likely involve Noop
, but some may involve
implementing their own.