#[non_exhaustive]pub struct Session {
pub world: World,
pub stages: SystemStages,
pub active: bool,
pub visible: bool,
pub priority: i32,
pub runner: Box<dyn SessionRunner>,
}Expand description
Contains a bones World for state, SystemStages for behavior, and a
SessionRunner to determine how those are used.
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.world: WorldThe ECS world for the core.
stages: SystemStagesThe system stages.
active: boolWhether or not this session should have it’s systems run.
visible: boolWhether or not this session should be rendered.
priority: i32The priority of this session relative to other sessions in the Game.
runner: Box<dyn SessionRunner>The session runner to use for this session.
Implementations§
Source§impl Session
impl Session
Sourcepub fn priority(&mut self, priority: i32) -> &mut Self
pub fn priority(&mut self, priority: i32) -> &mut Self
Set the priority of this session relative to other sessions in the Game.
Sourcepub fn runner(&mut self, runner: Box<dyn SessionRunner>) -> &mut Self
pub fn runner(&mut self, runner: Box<dyn SessionRunner>) -> &mut Self
Set the SessionRunner to use for this session.
Sourcepub fn activity(&mut self, active: bool) -> &mut Self
pub fn activity(&mut self, active: bool) -> &mut Self
Set whether or not this session should have it’s systems run.
Sourcepub fn visibility(&mut self, visible: bool) -> &mut Self
pub fn visibility(&mut self, visible: bool) -> &mut Self
Set whether or not this session should be rendered.
Sourcepub fn install_plugin(&mut self, plugin: impl SessionPlugin) -> &mut Self
pub fn install_plugin(&mut self, plugin: impl SessionPlugin) -> &mut Self
Install a SessionPlugin.
Methods from Deref<Target = SystemStages>§
pub fn add_system_to_stage<Args, S>(
&mut self,
label: impl StageLabel,
system: S,
) -> &mut SystemStages
pub fn add_system_to_stage<Args, S>( &mut self, label: impl StageLabel, system: S, ) -> &mut SystemStages
Add a System to the stage with the given label.
pub fn insert_stage_before<L, S>(
&mut self,
label: L,
stage: S,
) -> &mut SystemStageswhere
L: StageLabel,
S: SystemStage + 'static,
pub fn insert_stage_before<L, S>(
&mut self,
label: L,
stage: S,
) -> &mut SystemStageswhere
L: StageLabel,
S: SystemStage + 'static,
Insert a new stage, before another existing stage
pub fn insert_stage_after<L, S>(
&mut self,
label: L,
stage: S,
) -> &mut SystemStageswhere
L: StageLabel,
S: SystemStage + 'static,
pub fn insert_stage_after<L, S>(
&mut self,
label: L,
stage: S,
) -> &mut SystemStageswhere
L: StageLabel,
S: SystemStage + 'static,
Insert a new stage, after another existing stage
pub fn add_startup_system<Args, S>(&mut self, system: S) -> &mut SystemStages
👎Deprecated: use .add_system_to_stage(CoreStage::Startup, your_system) instead
pub fn add_startup_system<Args, S>(&mut self, system: S) -> &mut SystemStages
.add_system_to_stage(CoreStage::Startup, your_system) insteadAdd a system to the CoreStage::Startup stage which specially runs
only once, before all other core stages. Inserting CoreStageStartupSystemsRan
into the world prevents systems in the startup stage from running.
pub fn add_single_success_system<Args, S>(
&mut self,
system: S,
) -> &mut SystemStages
👎Deprecated: use `.add_system_to_stage(First, single_success_system(your_system)
pub fn add_single_success_system<Args, S>( &mut self, system: S, ) -> &mut SystemStages
Convenience method. Adds a system that will run each frame until it succeeds (returns Some).
Uses Option to allow for easy usage of ?. System is added to
CoreStage::First.
See also the wrapper function used inside single_success_system.
pub fn init_startup_resource<R>(&mut self) -> &mut SystemStages
pub fn init_startup_resource<R>(&mut self) -> &mut SystemStages
Adds a system to CoreStage::Startup that inserts the default value
of a resource into the World if it doesn’t already exist.
pub fn add_startup_resource<R>(&mut self, resource: R) -> &mut SystemStageswhere
R: HasSchema,
pub fn add_startup_resource<R>(&mut self, resource: R) -> &mut SystemStageswhere
R: HasSchema,
Adds a system to CoreStage::StartupResource that inserts the given
resource into the World if it doesn’t already exist. The resource
type is required to have a HasSchema clone implementation to
re-insert the resource into the world after the first startup.
§Clone Requirement Details
If the type being added implements HasSchema with the derive like
so:
#[derive(HasSchema, Default)]
#[schema(no_clone)] // This bypasses HasSchema clone requirements.
struct ResourceBeingInserted;Then the system being added to the StartupResource system stage will
panic when inserting a second time. The startup resource stage only runs
once so it is therefore safe to use a type like the example above as
long as you don’t plan on removing from the World the
StartupSystemStage tag which in this case is
CoreStageStartupResourceSystemsRan.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Session
impl !RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl !UnwindSafe for Session
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
§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.