Struct moonshine_save::save::SavePipelineBuilder
source · pub struct SavePipelineBuilder<F: QueryFilter> { /* private fields */ }Expand description
A convenient builder for defining a SavePipeline.
See save, save_default, save_all on how to create an instance of this type.
Implementations§
source§impl<F> SavePipelineBuilder<F>where
F: 'static + QueryFilter,
impl<F> SavePipelineBuilder<F>where
F: 'static + QueryFilter,
sourcepub fn include_resource<R: Resource>(self) -> Self
pub fn include_resource<R: Resource>(self) -> Self
Includes a given Resource type into the save pipeline.
By default, all resources are excluded from the save pipeline.
§Example
use bevy::prelude::*;
use moonshine_save::prelude::*;
#[derive(Resource, Default, Reflect)]
#[reflect(Resource)]
struct R;
let mut app = App::new();
app.register_type::<R>()
.insert_resource(R)
.add_plugins((MinimalPlugins, SavePlugin))
.add_systems(
PreUpdate,
save_default()
.include_resource::<R>()
.into_file("example.ron"));sourcepub fn include_resource_by_id(self, type_id: TypeId) -> Self
pub fn include_resource_by_id(self, type_id: TypeId) -> Self
sourcepub fn exclude_component<T: Component>(self) -> Self
pub fn exclude_component<T: Component>(self) -> Self
Excludes a given Component type from the save pipeline.
By default, all components which derive Reflect are included in the save pipeline.
§Example
use bevy::prelude::*;
use moonshine_save::prelude::*;
#[derive(Resource, Default, Reflect)]
#[reflect(Resource)]
struct R;
let mut app = App::new();
app.register_type::<R>()
.insert_resource(R)
.add_plugins((MinimalPlugins, SavePlugin))
.add_systems(
PreUpdate,
save_default()
.exclude_component::<Transform>()
.into_file("example.ron"));sourcepub fn exclude_component_by_id(self, type_id: TypeId) -> Self
pub fn exclude_component_by_id(self, type_id: TypeId) -> Self
sourcepub fn into_file(self, path: impl Into<PathBuf>) -> SavePipeline
pub fn into_file(self, path: impl Into<PathBuf>) -> SavePipeline
Finishes the save pipeline by writing the saved data into a file at given path.
sourcepub fn into_file_on_request<R: FilePath + Resource>(self) -> SavePipeline
pub fn into_file_on_request<R: FilePath + Resource>(self) -> SavePipeline
Finishes the save pipeline by writing the saved data into a file with its path derived from a resource of type R.
The save pipeline will only be triggered if a resource of type R is present.
sourcepub fn into_file_on_event<R: FilePath + Event>(self) -> SavePipeline
pub fn into_file_on_event<R: FilePath + Event>(self) -> SavePipeline
Finishes the save pipeline by writing the saved data into a file with its path derived from an event of type R.
The save pipeline will only be triggered if an event of type R is sent.
§Warning
If multiple events are sent in a single update cycle, only the first one is processed.
Auto Trait Implementations§
impl<F> Freeze for SavePipelineBuilder<F>
impl<F> RefUnwindSafe for SavePipelineBuilder<F>where
F: RefUnwindSafe,
impl<F> Send for SavePipelineBuilder<F>where
F: Send,
impl<F> Sync for SavePipelineBuilder<F>where
F: Sync,
impl<F> Unpin for SavePipelineBuilder<F>where
F: Unpin,
impl<F> UnwindSafe for SavePipelineBuilder<F>where
F: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.