Struct bevy::ecs::identifier::Identifier
source · #[repr(C, align(8))]pub struct Identifier { /* private fields */ }
Expand description
A unified identifier for all entity and similar IDs.
Has the same size as a u64
integer, but the layout is split between a 32-bit low
segment, a 31-bit high segment, and the significant bit reserved as type flags to denote
entity kinds.
Implementations§
source§impl Identifier
impl Identifier
sourcepub const fn new(
low: u32,
high: u32,
kind: IdKind
) -> Result<Identifier, IdentifierError>
pub const fn new( low: u32, high: u32, kind: IdKind ) -> Result<Identifier, IdentifierError>
Construct a new Identifier
. The high
parameter is masked with the
kind
so to pack the high value and bit flags into the same field.
sourcepub const fn low(self) -> u32
pub const fn low(self) -> u32
Returns the value of the low segment of the Identifier
.
sourcepub const fn high(self) -> NonZeroU32
pub const fn high(self) -> NonZeroU32
Returns the value of the high segment of the Identifier
. This
does not apply any masking.
sourcepub const fn masked_high(self) -> u32
pub const fn masked_high(self) -> u32
Returns the masked value of the high segment of the Identifier
.
Does not include the flag bits.
sourcepub const fn kind(self) -> IdKind
pub const fn kind(self) -> IdKind
Returns the kind of Identifier
from the high segment.
sourcepub const fn to_bits(self) -> u64
pub const fn to_bits(self) -> u64
Convert the Identifier
into a u64
.
sourcepub const fn from_bits(value: u64) -> Identifier
pub const fn from_bits(value: u64) -> Identifier
Convert a u64
into an Identifier
.
Panics
This method will likely panic if given u64
values that did not come from Identifier::to_bits
.
sourcepub const fn try_from_bits(value: u64) -> Result<Identifier, IdentifierError>
pub const fn try_from_bits(value: u64) -> Result<Identifier, IdentifierError>
Convert a u64
into an Identifier
.
This method is the fallible counterpart to Identifier::from_bits
.
Trait Implementations§
source§impl Clone for Identifier
impl Clone for Identifier
source§fn clone(&self) -> Identifier
fn clone(&self) -> Identifier
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Identifier
impl Debug for Identifier
source§impl From<Entity> for Identifier
impl From<Entity> for Identifier
source§fn from(value: Entity) -> Identifier
fn from(value: Entity) -> Identifier
source§impl Hash for Identifier
impl Hash for Identifier
source§impl Ord for Identifier
impl Ord for Identifier
source§fn cmp(&self, other: &Identifier) -> Ordering
fn cmp(&self, other: &Identifier) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for Identifier
impl PartialEq for Identifier
source§fn eq(&self, other: &Identifier) -> bool
fn eq(&self, other: &Identifier) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for Identifier
impl PartialOrd for Identifier
source§fn partial_cmp(&self, other: &Identifier) -> Option<Ordering>
fn partial_cmp(&self, other: &Identifier) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl TryFrom<Identifier> for Entity
impl TryFrom<Identifier> for Entity
§type Error = IdentifierError
type Error = IdentifierError
source§fn try_from(
value: Identifier
) -> Result<Entity, <Entity as TryFrom<Identifier>>::Error>
fn try_from( value: Identifier ) -> Result<Entity, <Entity as TryFrom<Identifier>>::Error>
impl Copy for Identifier
impl Eq for Identifier
Auto Trait Implementations§
impl RefUnwindSafe for Identifier
impl Send for Identifier
impl Sync for Identifier
impl Unpin for Identifier
impl UnwindSafe for Identifier
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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>
. Box<dyn Any>
can
then be further downcast
into Box<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>
. Rc<Any>
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> DowncastSync for T
impl<T> DowncastSync for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.