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>,

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>>

Wraps this view to be able to iterate modified components.

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)>

Returns the deleted components of a storage tracking deletion.

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>

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>,

pub fn deleted(&self) -> impl Iterator<Item = (EntityId, &T)>

Returns the deleted components of a storage tracking deletion.

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, Insertion>
where T: Component<Tracking = 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>>

Wraps this view to be able to iterate inserted and modified components.

§

impl<T> View<'_, T, Modification>
where T: Component<Tracking = 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>>

Wraps this view to be able to iterate inserted and modified components.

§

impl<T> View<'_, T, Removal>
where T: Component<Tracking = Removal>,

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>

Returns the ids of removed or deleted components of a storage tracking removal and/or deletion.

§

impl<'a, T> View<'a, T>
where T: Component,

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

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

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

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

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

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>,

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();

Trait Implementations§

source§

impl<'a> TreeRef for TreeRefView<'a>

source§

fn parent_id(&self, id: NodeId) -> Option<NodeId>

The parent id of the node.
source§

fn children_ids(&self, id: NodeId) -> Vec<NodeId>

The children ids of the node.
source§

fn height(&self, id: NodeId) -> Option<u16>

The height of the node.
source§

fn contains(&self, id: NodeId) -> bool

Returns true if the node exists.
source§

fn shadow_tree(&self, id: NodeId) -> Option<&ShadowTree>

The shadow tree tree under the node.
source§

fn slot_for_light_tree(&self, id: NodeId) -> Option<NodeId>

The node that contains the shadow tree this node is a slot for
source§

fn root_for_light_tree(&self, id: NodeId) -> Option<NodeId>

The node that contains the shadow tree this node is a root of
source§

fn parent_id_advanced( &self, id: NodeId, enter_shadow_dom: bool, ) -> Option<NodeId>

Get the id of the parent of the current node, if enter_shadow_dom is true and the current node is a shadow root, the node the shadow root is attached to will be returned
source§

fn children_ids_advanced( &self, id: NodeId, enter_shadow_dom: bool, ) -> Vec<NodeId>

Get the ids of the children of the current node, if enter_shadow_dom is true and the current node is a shadow slot, the ids of the nodes under the node the shadow slot is attached to will be returned
§

impl<'a, T> AsRef<SparseSet<T>> for View<'a, T>
where T: Component,

§

fn as_ref(&self) -> &SparseSet<T>

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<'a, T> BorrowInfo for View<'a, T>
where T: Send + Sync + Component,

§

fn borrow_info(info: &mut Vec<TypeInfo>)

This information is used during workload creation to determine which systems can run in parallel. Read more
§

impl<'a, T> Clone for View<'a, T>
where T: Component,

§

fn clone(&self) -> View<'a, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T> Debug for View<'_, T>
where T: Debug + Component,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'a, T> Deref for View<'a, T>
where T: Component,

§

type Target = SparseSet<T>

The resulting type after dereferencing.
§

fn deref(&self) -> &<View<'a, T> as Deref>::Target

Dereferences the value.
§

impl<T> Index<EntityId> for View<'_, T>
where T: Component,

§

type Output = T

The returned type after indexing.
§

fn index(&self, entity: EntityId) -> &<View<'_, T> as Index<EntityId>>::Output

Performs the indexing (container[index]) operation. Read more
§

impl<T> IntoBorrow for View<'_, T>
where T: Send + Sync + Component, <T as Component>::Tracking: Send + Sync,

§

type Borrow = ViewBorrower<T>

Helper type almost allowing GAT on stable.