#[non_exhaustive]pub struct RestoreOptions<'a> {
pub custom_strategy_factory: CustomStrategyFactory<'a>,
}Expand description
Options for WorldSnapshot::restore and
Simulation::restore_bytes.
Construct via Default::default when the snapshot only uses
built-in strategies, or via with_factory
when groups in the snapshot reference Custom dispatch strategies
that need to be re-instantiated by name. The struct is
#[non_exhaustive] so future restore knobs can land without an API
break.
// Built-ins only:
let _sim = snap.restore(RestoreOptions::default())?;Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.custom_strategy_factory: CustomStrategyFactory<'a>Factory mapping Custom
strategy names to fresh trait-object instances. None when the
snapshot only uses built-in strategies — restore returns
SimError::UnresolvedCustomStrategy
if a snapshot group needs a custom strategy and the factory isn’t
supplied (or returns None).
Implementations§
Source§impl<'a> RestoreOptions<'a>
impl<'a> RestoreOptions<'a>
Sourcepub fn with_factory(
factory: &'a dyn Fn(&str) -> Option<Box<dyn DispatchStrategy>>,
) -> Self
pub fn with_factory( factory: &'a dyn Fn(&str) -> Option<Box<dyn DispatchStrategy>>, ) -> Self
Build a RestoreOptions with a custom-strategy factory wired
up. Use Default::default when no custom strategies are in
play.
Trait Implementations§
Source§impl<'a> Clone for RestoreOptions<'a>
impl<'a> Clone for RestoreOptions<'a>
Source§fn clone(&self) -> RestoreOptions<'a>
fn clone(&self) -> RestoreOptions<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more