Type Alias freya_native_core::tree::TreeRefView
source · pub type TreeRefView<'a> = View<'a, Node>;
Expand description
A view of a tree.
Aliased Type§
struct TreeRefView<'a> { /* private fields */ }
Implementations
§impl<T> View<'_, T, All>where
T: Component<Tracking = All>,
impl<T> View<'_, T, All>where
T: Component<Tracking = All>,
pub fn inserted(&self) -> Inserted<&View<'_, T, All>>
pub fn inserted(&self) -> Inserted<&View<'_, T, All>>
Wraps this view to be able to iterate inserted components.
pub fn modified(&self) -> Modified<&View<'_, T, All>>
pub fn modified(&self) -> Modified<&View<'_, T, All>>
Wraps this view to be able to iterate modified components.
pub fn inserted_or_modified(&self) -> InsertedOrModified<&View<'_, T, All>>
pub fn inserted_or_modified(&self) -> InsertedOrModified<&View<'_, T, All>>
Wraps this view to be able to iterate inserted and modified components.
pub fn deleted(&self) -> impl Iterator<Item = (EntityId, &T)>
pub fn deleted(&self) -> impl Iterator<Item = (EntityId, &T)>
Returns the deleted components of a storage tracking deletion.
pub fn removed(&self) -> impl Iterator<Item = EntityId>
pub fn removed(&self) -> impl Iterator<Item = EntityId>
Returns the ids of removed components of a storage tracking removal.
pub fn removed_or_deleted(&self) -> impl Iterator<Item = EntityId>
pub fn removed_or_deleted(&self) -> impl Iterator<Item = EntityId>
Returns the ids of removed or deleted components of a storage tracking removal and/or deletion.
§impl<T> View<'_, T, Deletion>where
T: Component<Tracking = Deletion>,
impl<T> View<'_, T, Deletion>where
T: Component<Tracking = Deletion>,
§impl<T> View<'_, T, Insertion>where
T: Component<Tracking = Insertion>,
impl<T> View<'_, T, Insertion>where
T: Component<Tracking = Insertion>,
pub fn inserted(&self) -> Inserted<&View<'_, T, Insertion>>
pub fn inserted(&self) -> Inserted<&View<'_, T, Insertion>>
Wraps this view to be able to iterate inserted components.
pub fn inserted_or_modified(
&self,
) -> InsertedOrModified<&View<'_, T, Insertion>>
pub fn inserted_or_modified( &self, ) -> InsertedOrModified<&View<'_, T, Insertion>>
Wraps this view to be able to iterate inserted and modified components.
§impl<T> View<'_, T, Modification>where
T: Component<Tracking = Modification>,
impl<T> View<'_, T, Modification>where
T: Component<Tracking = Modification>,
pub fn modified(&self) -> Modified<&View<'_, T, Modification>>
pub fn modified(&self) -> Modified<&View<'_, T, Modification>>
Wraps this view to be able to iterate modified components.
pub fn inserted_or_modified(
&self,
) -> InsertedOrModified<&View<'_, T, Modification>>
pub fn inserted_or_modified( &self, ) -> InsertedOrModified<&View<'_, T, Modification>>
Wraps this view to be able to iterate inserted and modified components.
§impl<T> View<'_, T, Removal>where
T: Component<Tracking = Removal>,
impl<T> View<'_, T, Removal>where
T: Component<Tracking = Removal>,
§impl<'a, T> View<'a, T>where
T: Component,
impl<'a, T> View<'a, T>where
T: Component,
pub fn is_inserted(&self, entity: EntityId) -> bool
pub fn is_inserted(&self, entity: EntityId) -> bool
Inside a workload returns true
if entity
’s component was inserted since the last run of this system.
Outside workloads returns true
if entity
’s component was inserted since the last call to clear_all_inserted
.
Returns false
if entity
does not have a component in this storage.
pub fn is_modified(&self, entity: EntityId) -> bool
pub fn is_modified(&self, entity: EntityId) -> bool
Inside a workload returns true
if entity
’s component was modified since the last run of this system.
Outside workloads returns true
if entity
’s component was modified since the last call to clear_all_modified
.
Returns false
if entity
does not have a component in this storage.
pub fn is_inserted_or_modified(&self, entity: EntityId) -> bool
pub fn is_inserted_or_modified(&self, entity: EntityId) -> bool
Inside a workload returns true
if entity
’s component was inserted or modified since the last run of this system.
Outside workloads returns true
if entity
’s component was inserted or modified since the last clear call.
Returns false
if entity
does not have a component in this storage.
pub fn is_deleted(&self, entity: EntityId) -> bool
pub fn is_deleted(&self, entity: EntityId) -> bool
Inside a workload returns true
if entity
’s component was deleted since the last run of this system.
Outside workloads returns true
if entity
’s component was deleted since the last call to clear_all_deleted
.
Returns false
if entity
does not have a component in this storage.
pub fn is_removed(&self, entity: EntityId) -> bool
pub fn is_removed(&self, entity: EntityId) -> bool
Inside a workload returns true
if entity
’s component was removed since the last run of this system.
Outside workloads returns true
if entity
’s component was removed since the last call to clear_all_removed
.
Returns false
if entity
does not have a component in this storage.
pub fn is_removed_or_deleted(&self, entity: EntityId) -> bool
pub fn is_removed_or_deleted(&self, entity: EntityId) -> bool
Inside a workload returns true
if entity
’s component was deleted or removed since the last run of this system.
Outside workloads returns true
if entity
’s component was deleted or removed since the last clear call.
Returns false
if entity
does not have a component in this storage.
§impl<'a, T> View<'a, T, Untracked>where
T: Component<Tracking = Untracked>,
impl<'a, T> View<'a, T, Untracked>where
T: Component<Tracking = Untracked>,
pub fn new_for_custom_storage(
storage_id: StorageId,
all_storages: Ref<'a, &'a AllStorages>,
) -> Result<View<'a, T, Untracked>, CustomStorageView>
pub fn new_for_custom_storage( storage_id: StorageId, all_storages: Ref<'a, &'a AllStorages>, ) -> Result<View<'a, T, Untracked>, CustomStorageView>
Creates a new [View
] for custom [SparseSet
] storage.
use shipyard::{track, Component, SparseSet, StorageId, View, World};
struct ScriptingComponent(Vec<u8>);
impl Component for ScriptingComponent {
type Tracking = track::Untracked;
}
let world = World::new();
world.add_custom_storage(
StorageId::Custom(0),
SparseSet::<ScriptingComponent>::new_custom_storage(),
).unwrap();
let all_storages = world.all_storages().unwrap();
let scripting_storage =
View::<ScriptingComponent>::new_for_custom_storage(StorageId::Custom(0), all_storages)
.unwrap();