Struct valence::ecs::schedule::ScheduleGraph
pub struct ScheduleGraph { /* private fields */ }
Expand description
Metadata for a Schedule
.
The order isn’t optimized; calling ScheduleGraph::build_schedule
will return a
SystemSchedule
where the order is optimized for execution.
Implementations§
§impl ScheduleGraph
impl ScheduleGraph
pub fn new() -> ScheduleGraph
pub fn new() -> ScheduleGraph
Creates an empty ScheduleGraph
with default settings.
pub fn get_system_at(
&self,
id: NodeId,
) -> Option<&(dyn System<In = (), Out = ()> + 'static)>
pub fn get_system_at( &self, id: NodeId, ) -> Option<&(dyn System<In = (), Out = ()> + 'static)>
Returns the system at the given NodeId
, if it exists.
pub fn system_at(
&self,
id: NodeId,
) -> &(dyn System<In = (), Out = ()> + 'static)
pub fn system_at( &self, id: NodeId, ) -> &(dyn System<In = (), Out = ()> + 'static)
Returns the system at the given NodeId
.
Panics if it doesn’t exist.
pub fn get_set_at(&self, id: NodeId) -> Option<&(dyn SystemSet + 'static)>
pub fn get_set_at(&self, id: NodeId) -> Option<&(dyn SystemSet + 'static)>
Returns the set at the given NodeId
, if it exists.
pub fn set_at(&self, id: NodeId) -> &(dyn SystemSet + 'static)
pub fn set_at(&self, id: NodeId) -> &(dyn SystemSet + 'static)
Returns the set at the given NodeId
.
Panics if it doesn’t exist.
pub fn systems(
&self,
) -> impl Iterator<Item = (NodeId, &(dyn System<In = (), Out = ()> + 'static), &[Box<dyn ReadOnlySystem<In = (), Out = bool>>])>
pub fn systems( &self, ) -> impl Iterator<Item = (NodeId, &(dyn System<In = (), Out = ()> + 'static), &[Box<dyn ReadOnlySystem<In = (), Out = bool>>])>
Returns an iterator over all systems in this schedule, along with the conditions for each system.
pub fn system_sets(
&self,
) -> impl Iterator<Item = (NodeId, &(dyn SystemSet + 'static), &[Box<dyn ReadOnlySystem<In = (), Out = bool>>])>
pub fn system_sets( &self, ) -> impl Iterator<Item = (NodeId, &(dyn SystemSet + 'static), &[Box<dyn ReadOnlySystem<In = (), Out = bool>>])>
Returns an iterator over all system sets in this schedule, along with the conditions for each system set.
pub fn hierarchy(&self) -> &Dag
pub fn hierarchy(&self) -> &Dag
Returns the Dag
of the hierarchy.
The hierarchy is a directed acyclic graph of the systems and sets, where an edge denotes that a system or set is the child of another set.
pub fn dependency(&self) -> &Dag
pub fn dependency(&self) -> &Dag
Returns the Dag
of the dependencies in the schedule.
Nodes in this graph are systems and sets, and edges denote that a system or set has to run before another system or set.
pub fn conflicting_systems(&self) -> &[(NodeId, NodeId, Vec<ComponentId>)]
pub fn conflicting_systems(&self) -> &[(NodeId, NodeId, Vec<ComponentId>)]
Returns the list of systems that conflict with each other, i.e. have ambiguities in their access.
If the Vec<ComponentId>
is empty, the systems conflict on World
access.
Must be called after ScheduleGraph::build_schedule
to be non-empty.
pub fn initialize(&mut self, world: &mut World)
pub fn initialize(&mut self, world: &mut World)
Initializes any newly-added systems and conditions by calling System::initialize
pub fn build_schedule(
&mut self,
components: &Components,
schedule_label: Interned<dyn ScheduleLabel>,
ignored_ambiguities: &BTreeSet<ComponentId>,
) -> Result<SystemSchedule, ScheduleBuildError>
pub fn build_schedule( &mut self, components: &Components, schedule_label: Interned<dyn ScheduleLabel>, ignored_ambiguities: &BTreeSet<ComponentId>, ) -> Result<SystemSchedule, ScheduleBuildError>
Build a SystemSchedule
optimized for scheduler access from the ScheduleGraph
.
This method also
- checks for dependency or hierarchy cycles
- checks for system access conflicts and reports ambiguities
§impl ScheduleGraph
impl ScheduleGraph
pub fn conflicts_to_string<'a>(
&'a self,
ambiguities: &'a [(NodeId, NodeId, Vec<ComponentId>)],
components: &'a Components,
) -> impl Iterator<Item = (String, String, Vec<&'a str>)> + 'a
pub fn conflicts_to_string<'a>( &'a self, ambiguities: &'a [(NodeId, NodeId, Vec<ComponentId>)], components: &'a Components, ) -> impl Iterator<Item = (String, String, Vec<&'a str>)> + 'a
convert conflicts to human readable format
Trait Implementations§
§impl Default for ScheduleGraph
impl Default for ScheduleGraph
§fn default() -> ScheduleGraph
fn default() -> ScheduleGraph
Auto Trait Implementations§
impl Freeze for ScheduleGraph
impl !RefUnwindSafe for ScheduleGraph
impl Send for ScheduleGraph
impl Sync for ScheduleGraph
impl Unpin for ScheduleGraph
impl !UnwindSafe for ScheduleGraph
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> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World
.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.