pub struct ScheduleGraph {
pub systems: Systems,
pub system_sets: SystemSets,
pub ambiguous_with_all: HashSet<NodeId>,
/* 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.
Fields§
§systems: Systems
Container of systems in the schedule.
system_sets: SystemSets
Container of system sets in the schedule.
ambiguous_with_all: HashSet<NodeId>
Nodes that are allowed to have ambiguous ordering relationship with any other systems.
Implementations§
Source§impl ScheduleGraph
impl ScheduleGraph
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an empty ScheduleGraph
with default settings.
Sourcepub fn hierarchy(&self) -> &Dag<NodeId>
pub fn hierarchy(&self) -> &Dag<NodeId>
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.
Sourcepub fn dependency(&self) -> &Dag<NodeId>
pub fn dependency(&self) -> &Dag<NodeId>
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.
Sourcepub fn conflicting_systems(&self) -> &[(SystemKey, SystemKey, Vec<ComponentId>)]
pub fn conflicting_systems(&self) -> &[(SystemKey, SystemKey, 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.
Sourcepub 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
.
Sourcepub fn build_schedule(
&mut self,
world: &mut World,
ignored_ambiguities: &BTreeSet<ComponentId>,
) -> Result<(SystemSchedule, Vec<ScheduleBuildWarning>), ScheduleBuildError>
pub fn build_schedule( &mut self, world: &mut World, ignored_ambiguities: &BTreeSet<ComponentId>, ) -> Result<(SystemSchedule, Vec<ScheduleBuildWarning>), ScheduleBuildError>
Builds an execution-optimized SystemSchedule
from the current state
of the graph. Also returns any warnings that were generated during the
build process.
This method also
- checks for dependency or hierarchy cycles
- checks for system access conflicts and reports ambiguities
Source§impl ScheduleGraph
impl ScheduleGraph
Sourcepub fn get_node_name(&self, id: &NodeId) -> String
pub fn get_node_name(&self, id: &NodeId) -> String
Returns the name of the node with the given NodeId
. Resolves
anonymous sets to a string that describes their contents.
Also displays the set(s) the node is contained in if
ScheduleBuildSettings::report_sets
is true, and shortens system names
if ScheduleBuildSettings::use_shortnames
is true.
Sourcepub fn topsort_graph<N: GraphNodeId + Into<NodeId>>(
&self,
graph: &DiGraph<N>,
report: ReportCycles,
) -> Result<Vec<N>, ScheduleBuildError>
pub fn topsort_graph<N: GraphNodeId + Into<NodeId>>( &self, graph: &DiGraph<N>, report: ReportCycles, ) -> Result<Vec<N>, ScheduleBuildError>
Tries to topologically sort graph
.
If the graph is acyclic, returns Ok
with the list of NodeId
in a valid
topological order. If the graph contains cycles, returns Err
with the list of
strongly-connected components that contain cycles (also in a valid topological order).
§Errors
If the graph contain cycles, then an error is returned.
Sourcepub fn conflicts_to_string<'a>(
&'a self,
ambiguities: &'a [(SystemKey, SystemKey, Vec<ComponentId>)],
components: &'a Components,
) -> impl Iterator<Item = (String, String, Vec<DebugName>)> + 'a
pub fn conflicts_to_string<'a>( &'a self, ambiguities: &'a [(SystemKey, SystemKey, Vec<ComponentId>)], components: &'a Components, ) -> impl Iterator<Item = (String, String, Vec<DebugName>)> + 'a
convert conflicts to human readable format
Trait Implementations§
Source§impl Default for ScheduleGraph
impl Default for ScheduleGraph
Source§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
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>
, which can then be
downcast
into Box<dyn 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>
, which 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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self
using default()
.