pub struct Stat {
stat_type_entry: StatTypeEntryRef,
value: &'static dyn StatValueRegistryEntry,
}Expand description
Identifies a particular stat whose generic type is erased. This stat can also be encoded to and decoded from the network.
This is analogous to Vanilla’s Stat<?>.
Fields§
§stat_type_entry: StatTypeEntryRef§value: &'static dyn StatValueRegistryEntryImplementations§
Source§impl Stat
impl Stat
Sourcepub fn new<R: RegistryExt>(
stat_type: StatTypeRef<R>,
value: &'static R::Entry,
) -> Selfwhere
R::Entry: StatValueRegistryEntry,
pub fn new<R: RegistryExt>(
stat_type: StatTypeRef<R>,
value: &'static R::Entry,
) -> Selfwhere
R::Entry: StatValueRegistryEntry,
Attempts to create a new erased stat from its type and value with type safety.
This function panics if the stat type provided is unregistered
with the StatTypeRegistry.
Sourcepub const fn from_erased(
stat_type_entry: StatTypeEntryRef,
value: &'static dyn StatValueRegistryEntry,
) -> Self
pub const fn from_erased( stat_type_entry: StatTypeEntryRef, value: &'static dyn StatValueRegistryEntry, ) -> Self
Creates a new erased stat from its erased type and value.
Sourcepub const fn stat_type(&self) -> StatTypeEntryRef
pub const fn stat_type(&self) -> StatTypeEntryRef
Gets the type-erased stat type of this stat.
Sourcepub const fn stat_value(&self) -> &'static dyn StatValueRegistryEntry
pub const fn stat_value(&self) -> &'static dyn StatValueRegistryEntry
Gets the type-erased stat value of this stat.
Sourcepub const fn stat_type_key(&self) -> &Identifier
pub const fn stat_type_key(&self) -> &Identifier
Gets the key of the stat type of this stat.
Sourcepub fn stat_value_key(&self) -> &Identifier
pub fn stat_value_key(&self) -> &Identifier
Gets the key of the stat value of this stat.
Sourcepub fn stat_type_id(&self) -> usize
pub fn stat_type_id(&self) -> usize
Gets the registry ID of the stat type of this stat.
Sourcepub fn stat_value_id(&self) -> usize
pub fn stat_value_id(&self) -> usize
Gets the registry ID of the stat value of this stat.
Trait Implementations§
impl Copy for Stat
impl Eq for Stat
Auto Trait Implementations§
impl !RefUnwindSafe for Stat
impl !UnwindSafe for Stat
impl Freeze for Stat
impl Send for Stat
impl Sync for Stat
impl Unpin for Stat
impl UnsafeUnpin for Stat
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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 moreWraps this value in an
Arc<SyncMutex<>>