pub struct SnapshotBuilder<'a> { /* private fields */ }
Expand description
Implementations§
Source§impl<'a> SnapshotBuilder<'a>
impl<'a> SnapshotBuilder<'a>
Sourcepub fn snapshot(world: &'a World) -> Self
pub fn snapshot(world: &'a World) -> Self
Create a new SnapshotBuilder
from the World
.
You must call at least one of the extract
methods or the built snapshot will be empty.
§Example
SnapshotBuilder::snapshot(world)
// Extract all matching entities and resources
.extract_all()
// Clear all extracted entities without any components
.clear_empty()
// Build the `Snapshot`
.build();
Sourcepub fn rollback(world: &'a World) -> Self
pub fn rollback(world: &'a World) -> Self
Create a new SnapshotBuilder
from the World
.
Types extracted by this builder will respect the RollbackRegistry
.
You must call at least one of the extract
methods or the built snapshot will be empty.
§Example
SnapshotBuilder::rollback(world)
// Extract all matching entities and resources
.extract_all()
// Clear all extracted entities without any components
.clear_empty()
// Build the `Snapshot`
.build();
Source§impl<'a> SnapshotBuilder<'a>
impl<'a> SnapshotBuilder<'a>
Source§impl<'a> SnapshotBuilder<'a>
impl<'a> SnapshotBuilder<'a>
Sourcepub fn filter(self, filter: SceneFilter) -> Self
pub fn filter(self, filter: SceneFilter) -> Self
Specify a custom SceneFilter
to be used with this builder.
This filter is applied to both components and resources.
Sourcepub fn allow<T: Any>(self) -> Self
pub fn allow<T: Any>(self) -> Self
Allows the given type, T
, to be included in the generated snapshot.
This method may be called multiple times for any number of types.
This is the inverse of deny
.
If T
has already been denied, then it will be removed from the blacklist.
Sourcepub fn deny<T: Any>(self) -> Self
pub fn deny<T: Any>(self) -> Self
Denies the given type, T
, from being included in the generated snapshot.
This method may be called multiple times for any number of types.
This is the inverse of allow
.
If T
has already been allowed, then it will be removed from the whitelist.
Source§impl<'a> SnapshotBuilder<'a>
impl<'a> SnapshotBuilder<'a>
Sourcepub fn extract_entity(self, entity: Entity) -> Self
pub fn extract_entity(self, entity: Entity) -> Self
Extract a single entity from the builder’s World
.
Sourcepub fn extract_entities(self, entities: impl Iterator<Item = Entity>) -> Self
pub fn extract_entities(self, entities: impl Iterator<Item = Entity>) -> Self
Extract the given entities from the builder’s World
.
Sourcepub fn extract_entities_matching<F: Fn(&EntityRef<'_>) -> bool>(
self,
filter: F,
) -> Self
pub fn extract_entities_matching<F: Fn(&EntityRef<'_>) -> bool>( self, filter: F, ) -> Self
Extract the entities matching the given filter from the builder’s World
.
Sourcepub fn extract_all_entities(self) -> Self
pub fn extract_all_entities(self) -> Self
Extract all entities from the builder’s World
.
Sourcepub fn extract_resource<T: Resource>(self) -> Self
pub fn extract_resource<T: Resource>(self) -> Self
Extract a single resource from the builder’s World
.
Sourcepub fn extract_resource_by_path<T: AsRef<str>>(self, type_path: T) -> Self
pub fn extract_resource_by_path<T: AsRef<str>>(self, type_path: T) -> Self
Extract a single resource with the given type path from the builder’s World
.
Sourcepub fn extract_resources_by_path<T: AsRef<str>>(
self,
type_paths: impl Iterator<Item = T>,
) -> Self
pub fn extract_resources_by_path<T: AsRef<str>>( self, type_paths: impl Iterator<Item = T>, ) -> Self
Extract resources with the given type paths from the builder’s World
.
Sourcepub fn extract_all_resources(self) -> Self
pub fn extract_all_resources(self) -> Self
Extract all resources from the builder’s World
.
Sourcepub fn extract_rollbacks(self) -> Self
pub fn extract_rollbacks(self) -> Self
Sourcepub fn extract_all(self) -> Self
pub fn extract_all(self) -> Self
Extract all entities, and resources from the builder’s World
.
Sourcepub fn extract_all_with_rollbacks(self) -> Self
pub fn extract_all_with_rollbacks(self) -> Self
Source§impl<'a> SnapshotBuilder<'a>
impl<'a> SnapshotBuilder<'a>
Sourcepub fn clear_entities(self) -> Self
pub fn clear_entities(self) -> Self
Clear all extracted entities.
Sourcepub fn clear_resources(self) -> Self
pub fn clear_resources(self) -> Self
Clear all extracted resources.
Sourcepub fn clear_empty(self) -> Self
pub fn clear_empty(self) -> Self
Clear all extracted entities without any components.
Sourcepub fn clear_rollbacks(self) -> Self
pub fn clear_rollbacks(self) -> Self
Clear Rollbacks
from the snapshot.
Auto Trait Implementations§
impl<'a> Freeze for SnapshotBuilder<'a>
impl<'a> !RefUnwindSafe for SnapshotBuilder<'a>
impl<'a> Send for SnapshotBuilder<'a>
impl<'a> Sync for SnapshotBuilder<'a>
impl<'a> Unpin for SnapshotBuilder<'a>
impl<'a> !UnwindSafe for SnapshotBuilder<'a>
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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.