Union spacetimedb_primitives::ColList
source · #[repr(C)]
pub union ColList {
/* private fields */
}Expand description
This represents a non-empty list of ColId
but packed into a u64 in a way that takes advantage of the fact that
in almost all cases, we won’t store a ColId larger than 62.
In the rare case that we store larger ids, we fall back to a thin vec approach.
The list does not guarantee a stable order.
Implementations§
source§impl ColList
impl ColList
sourcepub fn new(col: ColId) -> Self
pub fn new(col: ColId) -> Self
Returns a list with a single column.
As long col is below 62, this will not allocate.
sourcepub fn contains(&self, needle: ColId) -> bool
pub fn contains(&self, needle: ColId) -> bool
Returns whether needle is contained in the list.
This an be faster than using list.iter().any(|c| c == needle).
sourcepub fn iter(&self) -> impl '_ + Iterator<Item = ColId>
pub fn iter(&self) -> impl '_ + Iterator<Item = ColId>
Returns an iterator over all the columns in this list.
sourcepub fn to_u32_vec(&self) -> Vec<u32>
pub fn to_u32_vec(&self) -> Vec<u32>
Convert to a Vec<u32>.
sourcepub fn is_singleton(&self) -> bool
pub fn is_singleton(&self) -> bool
Is this a list of a single column?
Trait Implementations§
source§impl Ord for ColList
impl Ord for ColList
source§impl PartialEq for ColList
impl PartialEq for ColList
source§impl PartialOrd for ColList
impl PartialOrd for ColList
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 Eq for ColList
impl Send for ColList
impl Sync for ColList
Auto Trait Implementations§
impl Freeze for ColList
impl RefUnwindSafe for ColList
impl Unpin for ColList
impl UnwindSafe for ColList
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
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
Converts
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>
Converts
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