Struct zng_app::render::SpatialFrameId
source · pub struct SpatialFrameId(/* private fields */);Expand description
Unique ID of a reference frame.
§Memory
The internal number is a NonZeroU32, that means that
Option<SpatialFrameId>
and
SpatialFrameId
are the same size as u32.
§As Hash
The generated internal number has good statistical distribution and can be used as its own hash,
although it is not cryptographically safe, as it is simply a sequential counter scrambled using a modified
splitmix64.
§Static
The unique ID cannot be generated at compile time, but you can use the new_static constructor to
create a lightweight lazy ID factory that will generate the ID on the first get.
Implementations§
source§impl SpatialFrameId
impl SpatialFrameId
sourcepub fn new_unique() -> Self
pub fn new_unique() -> Self
Generates a new unique ID.
sourcepub const fn new_static() -> StaticSpatialFrameId
pub const fn new_static() -> StaticSpatialFrameId
New static ID that will be generated on the first get.
sourcepub fn sequential(self) -> u32
pub fn sequential(self) -> u32
Un-scramble the underlying value to get the original sequential count number.
If two IDs, id0 and id1 where generated by the same thread then id0.sequential() < id1.sequential().
sourcepub fn from_raw(raw: u32) -> Self
pub fn from_raw(raw: u32) -> Self
Creates an ID from a raw value.
The value must not be zero, panics if it is, the value must have been provided by get otherwise
the ID will not be unique.
sourcepub fn from_sequential(num: u32) -> Self
pub fn from_sequential(num: u32) -> Self
Creates an ID from a sequential number.
§Safety
The value must not be zero, panics if it is, the value must have been provided by sequential otherwise
the ID will not be unique.
Trait Implementations§
source§impl Clone for SpatialFrameId
impl Clone for SpatialFrameId
source§impl Debug for SpatialFrameId
impl Debug for SpatialFrameId
source§impl From<&'static StaticSpatialFrameId> for SpatialFrameId
impl From<&'static StaticSpatialFrameId> for SpatialFrameId
source§fn from(st: &'static StaticSpatialFrameId) -> SpatialFrameId
fn from(st: &'static StaticSpatialFrameId) -> SpatialFrameId
source§impl From<SpatialFrameId> for ReferenceFrameId
impl From<SpatialFrameId> for ReferenceFrameId
source§fn from(id: SpatialFrameId) -> Self
fn from(id: SpatialFrameId) -> Self
source§impl Hash for SpatialFrameId
impl Hash for SpatialFrameId
source§impl PartialEq for SpatialFrameId
impl PartialEq for SpatialFrameId
impl Copy for SpatialFrameId
impl Eq for SpatialFrameId
impl NoUninit for SpatialFrameId
impl PodInOption for SpatialFrameId
impl ZeroableInOption for SpatialFrameId
Auto Trait Implementations§
impl Freeze for SpatialFrameId
impl RefUnwindSafe for SpatialFrameId
impl Send for SpatialFrameId
impl Sync for SpatialFrameId
impl Unpin for SpatialFrameId
impl UnwindSafe for SpatialFrameId
Blanket Implementations§
source§impl<T> AnyVarValue for Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>.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> 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.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more