Struct salsa_2022::id::Id
source · [−]pub struct Id { /* private fields */ }
Expand description
An Id is a newtype’d u32 ranging from 0..Id::MAX_U32
.
The maximum range is smaller than a standard u32 to leave
room for niches; currently there is only one niche, so that
Option<Id>
is the same size as an Id
.
You will rarely use the Id
type directly, though you can.
You are more likely to use types that implement the AsId
trait,
such as entity keys.
Implementations
sourceimpl Id
impl Id
pub const MAX_U32: u32 = 4_294_967_040u32
pub const MAX_USIZE: usize = 4_294_967_040usize
sourcepub fn from_u32(x: u32) -> Self
pub fn from_u32(x: u32) -> Self
Create a salsa::Id
from a u32 value. This value should
be less than Self::MAX_U32
.
In general, you should not need to create salsa ids yourself, but it can be useful if you are using the type as a general purpose “identifier” internally.
pub fn as_u32(self) -> u32
Trait Implementations
sourceimpl Ord for Id
impl Ord for Id
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<Id> for Id
impl PartialOrd<Id> for Id
sourcefn partial_cmp(&self, other: &Id) -> Option<Ordering>
fn partial_cmp(&self, other: &Id) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Id
impl Eq for Id
impl StructuralEq for Id
impl StructuralPartialEq for Id
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CallHasher for Twhere
T: Hash + ?Sized,
impl<T> CallHasher for Twhere
T: Hash + ?Sized,
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.