pub struct KnownPlayers {
entries: Vec<KnownPlayer>,
}Expand description
In-memory player identity cache.
Fields§
§entries: Vec<KnownPlayer>Implementations§
Source§impl KnownPlayers
impl KnownPlayers
Sourcepub fn from_entries(entries: impl IntoIterator<Item = KnownPlayer>) -> Self
pub fn from_entries(entries: impl IntoIterator<Item = KnownPlayer>) -> Self
Creates a normalized cache from entries.
Sourcepub fn entries(&self) -> &[KnownPlayer]
pub fn entries(&self) -> &[KnownPlayer]
Returns entries in stable cache order.
Sourcepub fn record(&mut self, uuid: Uuid, last_known_name: impl Into<String>) -> bool
pub fn record(&mut self, uuid: Uuid, last_known_name: impl Into<String>) -> bool
Records the latest identity for a UUID and case-insensitive name.
A name can belong to only one UUID. Returns whether the cache changed.
Sourcepub(crate) fn resolve_name(
&mut self,
name: &str,
now_millis: i64,
) -> KnownPlayerNameLookup
pub(crate) fn resolve_name( &mut self, name: &str, now_millis: i64, ) -> KnownPlayerNameLookup
Resolves and touches a cached name, removing it when its vanilla expiry elapsed.
Sourcepub(crate) fn resolve_uuid(&mut self, uuid: Uuid) -> Option<KnownPlayer>
pub(crate) fn resolve_uuid(&mut self, uuid: Uuid) -> Option<KnownPlayer>
Resolves and touches a cached UUID. Vanilla does not expiry-check UUID lookups.
Sourcepub fn by_uuid(&self, uuid: Uuid) -> Option<&KnownPlayer>
pub fn by_uuid(&self, uuid: Uuid) -> Option<&KnownPlayer>
Looks up a profile by UUID.
Sourcepub fn by_name(&self, name: &str) -> Option<&KnownPlayer>
pub fn by_name(&self, name: &str) -> Option<&KnownPlayer>
Looks up a profile by case-insensitive name.
fn insert_loaded(&mut self, entry: KnownPlayer)
Trait Implementations§
Source§impl Clone for KnownPlayers
impl Clone for KnownPlayers
Source§fn clone(&self) -> KnownPlayers
fn clone(&self) -> KnownPlayers
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KnownPlayers
impl Debug for KnownPlayers
Source§impl Default for KnownPlayers
impl Default for KnownPlayers
Source§fn default() -> KnownPlayers
fn default() -> KnownPlayers
Returns the “default value” for a type. Read more
impl Eq for KnownPlayers
Source§impl PartialEq for KnownPlayers
impl PartialEq for KnownPlayers
impl StructuralPartialEq for KnownPlayers
Auto Trait Implementations§
impl Freeze for KnownPlayers
impl RefUnwindSafe for KnownPlayers
impl Send for KnownPlayers
impl Sync for KnownPlayers
impl Unpin for KnownPlayers
impl UnsafeUnpin for KnownPlayers
impl UnwindSafe for KnownPlayers
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<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
Compares
self with key and returns 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<>>