pub struct ActivityId<K> { /* private fields */ }Expand description
Identifies an activity (the name an event realizes), interned to u32.
Zero-cost #[repr(transparent)] wrapper carrying a PhantomData<K>
kind marker. Structure-only: it names an entity, it does not resolve
or validate the link. Graduate to wasm4pm to dereference it.
Implementations§
Source§impl<K> ActivityId<K>
impl<K> ActivityId<K>
Sourcepub const fn new(raw: u32) -> Self
pub const fn new(raw: u32) -> Self
Wraps a raw u32 as a typed ActivityId.
§Examples
use wasm4pm_compat::ids::ActivityId;
enum Local {}
let id = ActivityId::<Local>::new(7);
assert_eq!(id.raw(), 7);Sourcepub const fn raw(self) -> u32
pub const fn raw(self) -> u32
Returns the underlying raw u32.
§Examples
use wasm4pm_compat::ids::ActivityId;
enum Local {}
assert_eq!(ActivityId::<Local>::new(42).raw(), 42);Sourcepub const fn into_inner(self) -> u32
pub const fn into_inner(self) -> u32
Trait Implementations§
Source§impl<K> AsRef<u32> for ActivityId<K>
impl<K> AsRef<u32> for ActivityId<K>
Source§impl<K> Clone for ActivityId<K>
impl<K> Clone for ActivityId<K>
impl<K> Copy for ActivityId<K>
Source§impl<K> Debug for ActivityId<K>
impl<K> Debug for ActivityId<K>
Source§impl<K> Display for ActivityId<K>
Displays the raw numeric value prefixed by the type name, e.g. EventId(7).
impl<K> Display for ActivityId<K>
Displays the raw numeric value prefixed by the type name, e.g. EventId(7).
impl<K> Eq for ActivityId<K>
Source§impl<K> From<ActivityId<K>> for u32
impl<K> From<ActivityId<K>> for u32
Source§fn from(id: ActivityId<K>) -> u32
fn from(id: ActivityId<K>) -> u32
Unwraps the typed id back to its raw primitive. Infallible.
Source§impl<K> From<u32> for ActivityId<K>
impl<K> From<u32> for ActivityId<K>
Source§impl<K> FromStr for ActivityId<K>
impl<K> FromStr for ActivityId<K>
Source§impl<K> Hash for ActivityId<K>
impl<K> Hash for ActivityId<K>
Source§impl<K> NewFromRaw for ActivityId<K>
impl<K> NewFromRaw for ActivityId<K>
Source§type Raw = u32
type Raw = u32
The underlying raw primitive (same as
TypedId::Raw).Source§fn new_from_raw(raw: u32) -> Self
fn new_from_raw(raw: u32) -> Self
Constructs
Self from a raw primitive. Identical to the concrete new fn.Source§impl<K> Ord for ActivityId<K>
impl<K> Ord for ActivityId<K>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<K> PartialEq for ActivityId<K>
impl<K> PartialEq for ActivityId<K>
Source§impl<K> PartialOrd for ActivityId<K>
impl<K> PartialOrd for ActivityId<K>
Auto Trait Implementations§
impl<K> Freeze for ActivityId<K>
impl<K> RefUnwindSafe for ActivityId<K>where
K: RefUnwindSafe,
impl<K> Send for ActivityId<K>where
K: Send,
impl<K> Sync for ActivityId<K>where
K: Sync,
impl<K> Unpin for ActivityId<K>where
K: Unpin,
impl<K> UnsafeUnpin for ActivityId<K>
impl<K> UnwindSafe for ActivityId<K>where
K: UnwindSafe,
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