pub struct NodeHandles { /* private fields */ }Expand description
Side-table mapping small i32 ids to node handles, for script hosts
whose value type cannot hold a 64-bit handle (candela’s Value is
internally i32). intern is idempotent per entity, so a handle
keeps the same id across a tick; the sentinel id 0 means “no node”.
Registered as a Resource for embedders that want a world-scoped
table; the runtime also drives a process-global instance (see
intern_node / resolve_node) so a Send + Sync host with no
&World at call time can still mint ids.
Implementations§
Source§impl NodeHandles
impl NodeHandles
Sourcepub fn intern(&mut self, entity: Entity, generation: u32) -> i32
pub fn intern(&mut self, entity: Entity, generation: u32) -> i32
Intern (entity, generation), returning a stable i32 id (>= 1).
Re-interning the same entity returns the same id.
Sourcepub fn intern_raw(&mut self, packed: u64) -> i32
pub fn intern_raw(&mut self, packed: u64) -> i32
Intern any packed handle (a real element’s NodeHandle::pack or a
reserved spawn token), returning a stable i32 id. Idempotent per
packed value.
Sourcepub fn resolve(&self, id: i32) -> Option<NodeHandle>
pub fn resolve(&self, id: i32) -> Option<NodeHandle>
Resolve an interned id back to a live-element handle. Returns None
for 0, an unknown id, or a reserved spawn token (which has no
entity until command-drain materializes it).
Sourcepub fn resolve_raw(&self, id: i32) -> Option<u64>
pub fn resolve_raw(&self, id: i32) -> Option<u64>
Resolve an interned id to its packed bits (real handle or reserved
spawn token). 0 / unknown yields None.
Trait Implementations§
Source§impl Component for NodeHandles
impl Component for NodeHandles
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor] required for working with relationships in dynamic contexts. Read more§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§impl Debug for NodeHandles
impl Debug for NodeHandles
Source§impl Default for NodeHandles
impl Default for NodeHandles
Source§fn default() -> NodeHandles
fn default() -> NodeHandles
impl Resource for NodeHandles
Auto Trait Implementations§
impl Freeze for NodeHandles
impl RefUnwindSafe for NodeHandles
impl Send for NodeHandles
impl Sync for NodeHandles
impl Unpin for NodeHandles
impl UnsafeUnpin for NodeHandles
impl UnwindSafe for NodeHandles
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<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
§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
Creates Self using default().