Struct bones_lib::reset::ResetWorld
source · pub struct ResetWorld {
pub reset: bool,
pub reset_resources: UntypedResourceSet,
}
Expand description
Resource that allows user to trigger a reset of world, clearing entities, components, and resources.
This is supported in bone’s default session runners - but if implementing custom runner, must call world.handle_world_reset
inside step.
reset_world: ResMutInit<ResetWorld>
and setting reset_world.reset = true;
may be used to trigger a reset from system execution.
Fields§
§reset: bool
Set to true to trigger reset of World
.
reset_resources: UntypedResourceSet
List of resources that will be inserted into World
after the resources are reset,
before startup systems are executed.
These override any startup resources
captured during session build.
If want to preserve a resource instead of having it reset, insert it here.
Implementations§
source§impl ResetWorld
impl ResetWorld
sourcepub fn insert_reset_resource<T: HasSchema>(&mut self, resource: T)
pub fn insert_reset_resource<T: HasSchema>(&mut self, resource: T)
Insert a resource that will be applied after reset. If resource was created on session iniialization, this will overwrite it using reset resource instead.
sourcepub fn reset_resource_mut<T: HasSchema>(&self) -> Option<RefMut<'_, T>>
pub fn reset_resource_mut<T: HasSchema>(&self) -> Option<RefMut<'_, T>>
Get a mutable reference to a reset resource if found.
sourcepub fn insert_empty_reset_resource<T: HasSchema>(&mut self)
pub fn insert_empty_reset_resource<T: HasSchema>(&mut self)
Insert resource in “empty” state - If resource was created
on session iniialization, instead of being reset to that state,
after reset this resource will not be on World
.
Trait Implementations§
source§impl Clone for ResetWorld
impl Clone for ResetWorld
source§fn clone(&self) -> ResetWorld
fn clone(&self) -> ResetWorld
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Default for ResetWorld
impl Default for ResetWorld
source§fn default() -> ResetWorld
fn default() -> ResetWorld
source§impl HasSchema for ResetWorld
impl HasSchema for ResetWorld
§fn register_schema()
fn register_schema()
§fn cast<T>(this: &Self) -> &Twhere
T: HasSchema,
fn cast<T>(this: &Self) -> &Twhere
T: HasSchema,
§fn try_cast<T>(this: &Self) -> Result<&T, SchemaMismatchError>where
T: HasSchema,
fn try_cast<T>(this: &Self) -> Result<&T, SchemaMismatchError>where
T: HasSchema,
§fn cast_mut<T>(this: &mut Self) -> &mut Twhere
T: HasSchema,
fn cast_mut<T>(this: &mut Self) -> &mut Twhere
T: HasSchema,
§fn try_cast_mut<T>(this: &mut Self) -> Result<&mut T, SchemaMismatchError>where
T: HasSchema,
fn try_cast_mut<T>(this: &mut Self) -> Result<&mut T, SchemaMismatchError>where
T: HasSchema,
§fn as_schema_ref(&self) -> SchemaRef<'_>where
Self: Sized,
fn as_schema_ref(&self) -> SchemaRef<'_>where
Self: Sized,
T
to a SchemaRef
§fn as_schema_mut(&mut self) -> SchemaRefMut<'_>where
Self: Sized,
fn as_schema_mut(&mut self) -> SchemaRefMut<'_>where
Self: Sized,
T
to a SchemaRefMut
Auto Trait Implementations§
impl Freeze for ResetWorld
impl !RefUnwindSafe for ResetWorld
impl Send for ResetWorld
impl Sync for ResetWorld
impl Unpin for ResetWorld
impl !UnwindSafe for ResetWorld
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &World) -> T
fn from_world(_world: &World) -> T
Self
using data from the given World
.