pub enum SystemAccess {
None,
Shared(FilteredAccessSet),
Exclusive,
}Variants§
None
The system does not access the world at all.
The system requires shared access to the world, which means it can run in parallel with other systems that also require shared access, as long as they don’t require exclusive access to the same components.
Exclusive
Implementations§
Source§impl SystemAccess
impl SystemAccess
Sourcepub fn is_none(&self) -> bool
pub fn is_none(&self) -> bool
Returns true if the system does not access the world at all, so it can run in parallel with any other system.
Returns true if the system requires shared access to the world, which means it can run in parallel with other systems that also require shared access, as long as they don’t require exclusive access to the same components.
Sourcepub fn is_exclusive(&self) -> bool
pub fn is_exclusive(&self) -> bool
Returns true if the system requires exclusive access to the world.
Sourcepub fn is_compatible(&self, other: &SystemAccess) -> bool
pub fn is_compatible(&self, other: &SystemAccess) -> bool
Returns true if this system’s access is compatible with the other system’s access, such that they can run in parallel without conflicting with each other.
Sourcepub fn get_conflicts_single(
&self,
filtered_access: &FilteredAccess,
) -> AccessConflicts
pub fn get_conflicts_single( &self, filtered_access: &FilteredAccess, ) -> AccessConflicts
Returns the conflicts between the system’s current access and the provided access.
- If the system currently has
Noneaccess, it will return an emptyAccessConflicts(i.e. no conflicts). - If the system currently has
Sharedaccess, the conflicts between individual components or resources will be returned. - If the system currently has
Exclusiveaccess, it will returnAccessConflicts::All.
Sourcepub fn get_conflicts(&self, other: &SystemAccess) -> AccessConflicts
pub fn get_conflicts(&self, other: &SystemAccess) -> AccessConflicts
Returns the conflicts between the system’s current access and another system’s access.
- If either system has
Noneaccess, it will return an emptyAccessConflicts(i.e. no conflicts). - If both systems have
Sharedaccess, the conflicts between individual components or resources will be returned. - If either system has
Exclusiveaccess, it will returnAccessConflicts::All.
Sourcepub fn to_filtered_access_set(&self) -> Cow<'_, FilteredAccessSet>
pub fn to_filtered_access_set(&self) -> Cow<'_, FilteredAccessSet>
Converts the system’s current access into a FilteredAccessSet.
Marks the system as requiring shared access to the world, which means it can run in parallel with other systems that also require shared access, as long as they don’t require exclusive access to the same components.
The provided type T is used for error reporting in case of access conflicts;
it should be the type of the system parameter that is requesting shared access.
§Panics
If the system already has exclusive access, this method will panic with an error message indicating the conflict.
§Examples
§Only metadata access required
If a system parameter requires access to world metadata but not any
particular components, you may call this function without modifying the
returned FilteredAccessSet:
pub struct MyWorldId(WorldId);
// SAFETY: World metadata is registered and accessed.
unsafe impl SystemParam for MyWorldId {
type State = ();
type Item<'world, 'state> = MyWorldId;
fn init_state(_: &mut World) -> Self::State {}
fn init_access(
_state: &Self::State,
system_meta: &mut SystemMeta,
system_access: &mut SystemAccess,
_world: &mut World,
) {
system_access.require_shared_access::<Self>(system_meta);
}
unsafe fn get_param<'world, 'state>(
_: &'state mut Self::State,
_: &SystemMeta,
world: UnsafeWorldCell<'world>,
_: Tick,
) -> Result<Self::Item<'world, 'state>, SystemParamValidationError> {
Ok(MyWorldId(world.id()))
}
}Sourcepub fn require_exclusive_access<T>(&mut self, system_meta: &SystemMeta)
pub fn require_exclusive_access<T>(&mut self, system_meta: &SystemMeta)
Marks the system as requiring exclusive access to the world, meaning no
other Shared or Exclusive system can run in parallel with it.
The provided type T is used for error reporting in case of access conflicts;
it should be the type of the system parameter that is requesting exclusive access.
§Panics
If the system already has shared or exclusive access, this method will panic with an error message indicating the conflict.
Sourcepub fn try_add(
&mut self,
filtered_access: FilteredAccess,
) -> Result<(), AccessConflicts>
pub fn try_add( &mut self, filtered_access: FilteredAccess, ) -> Result<(), AccessConflicts>
Attempts to add the provided FilteredAccess to the system’s current access.
- If the system currently has
Noneaccess, it will change this access toSharedand add the providedFilteredAccess. - If the system currently has
Sharedaccess, it will check for conflicts with the providedFilteredAccess. If there are no conflicts, it will add the providedFilteredAccess. If there are conflicts, it will return anAccessConflictserror. - If the system currently has
Exclusiveaccess, it will error withAccessConflicts::All.
§Errors
If there are conflicts with the system’s current access, an
AccessConflicts error will be returned.
Sourcepub fn ensure_filtered_access(&mut self, filtered_access: FilteredAccess)
pub fn ensure_filtered_access(&mut self, filtered_access: FilteredAccess)
Marks the system as requiring access to certain or all components or
resources in the World.
Sourcepub fn ensure_metadata_access(&mut self)
pub fn ensure_metadata_access(&mut self)
Marks the system as requiring access to World metadata
(e.g. Archetypes, Components, etc.).
Sourcepub fn extend(&mut self, other: SystemAccess)
pub fn extend(&mut self, other: SystemAccess)
Merges the provided SystemAccess into the system’s current access.
Trait Implementations§
Source§impl Clone for SystemAccess
impl Clone for SystemAccess
Source§fn clone(&self) -> SystemAccess
fn clone(&self) -> SystemAccess
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SystemAccess
impl Debug for SystemAccess
Source§impl Default for SystemAccess
impl Default for SystemAccess
Source§fn default() -> SystemAccess
fn default() -> SystemAccess
impl Eq for SystemAccess
Source§impl PartialEq for SystemAccess
impl PartialEq for SystemAccess
impl StructuralPartialEq for SystemAccess
Auto Trait Implementations§
impl Freeze for SystemAccess
impl RefUnwindSafe for SystemAccess
impl Send for SystemAccess
impl Sync for SystemAccess
impl Unpin for SystemAccess
impl UnsafeUnpin for SystemAccess
impl UnwindSafe for SystemAccess
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,
impl<T> ConditionalSend for Twhere
T: Send,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FromTemplate for T
impl<T> FromTemplate 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().
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Source§impl<T> Template for T
impl<T> Template for T
Source§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.Source§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.Source§impl<T> TypeData for T
impl<T> TypeData for T
Source§fn clone_type_data(&self) -> Box<dyn TypeData>
fn clone_type_data(&self) -> Box<dyn TypeData>
self.