Struct bevy::ecs::identifier::Identifier
#[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§
§impl Identifier
impl Identifier
pub 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.
pub const fn low(self) -> u32
pub const fn low(self) -> u32
Returns the value of the low segment of the Identifier
.
pub const fn high(self) -> NonZero<u32>
pub const fn high(self) -> NonZero<u32>
Returns the value of the high segment of the Identifier
. This
does not apply any masking.
pub 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.
pub const fn kind(self) -> IdKind
pub const fn kind(self) -> IdKind
Returns the kind of Identifier
from the high segment.
pub const fn to_bits(self) -> u64
pub const fn to_bits(self) -> u64
Convert the Identifier
into a u64
.
pub 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
.
pub 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§
§impl Clone for Identifier
impl Clone for Identifier
§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 more§impl Debug for Identifier
impl Debug for Identifier
§impl From<Entity> for Identifier
impl From<Entity> for Identifier
§fn from(value: Entity) -> Identifier
fn from(value: Entity) -> Identifier
§impl Hash for Identifier
impl Hash for Identifier
§impl Ord for Identifier
impl Ord for Identifier
§impl PartialEq for Identifier
impl PartialEq for Identifier
§fn eq(&self, other: &Identifier) -> bool
fn eq(&self, other: &Identifier) -> bool
self
and other
values to be equal, and is used
by ==
.§impl PartialOrd for Identifier
impl PartialOrd for Identifier
§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 more§impl TryFrom<Identifier> for Entity
impl TryFrom<Identifier> for Entity
§type Error = IdentifierError
type Error = IdentifierError
§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§
§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
§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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.