pub trait Pipeline: Sized {
type Backend: for<'a> Backend<Self::Key<'a>> + Resource + Default;
type Format: Format;
type Key<'a>;
// Required method
fn key(&self) -> Self::Key<'_>;
// Provided methods
fn build(app: &mut App) { ... }
fn capture(builder: SnapshotBuilder<'_>) -> Snapshot { ... }
fn capture_seed(&self, builder: SnapshotBuilder<'_>) -> Snapshot { ... }
fn apply(world: &mut World, snapshot: &Snapshot) -> Result<(), Error> { ... }
fn apply_seed(
&self,
world: &mut World,
snapshot: &Snapshot
) -> Result<(), Error> { ... }
}Expand description
Trait that defines how exactly your app saves and loads.
Required Associated Types§
Required Methods§
Provided Methods§
sourcefn build(app: &mut App)
fn build(app: &mut App)
Called when the pipeline is initialized with App::init_pipeline.
sourcefn capture(builder: SnapshotBuilder<'_>) -> Snapshot
fn capture(builder: SnapshotBuilder<'_>) -> Snapshot
sourcefn capture_seed(&self, builder: SnapshotBuilder<'_>) -> Snapshot
fn capture_seed(&self, builder: SnapshotBuilder<'_>) -> Snapshot
sourcefn apply_seed(
&self,
world: &mut World,
snapshot: &Snapshot
) -> Result<(), Error>
fn apply_seed( &self, world: &mut World, snapshot: &Snapshot ) -> Result<(), Error>
Apply a Snapshot to the [World], using the Pipeline as a seed.
This is usually used for partial snapshots.
Entity mapping goes here, along with your spawn hook and any other transformations you might need to perform.
Errors
If a type included in the Snapshot has not been registered with the type registry.
Object Safety§
This trait is not object safe.