pub struct ChatState {
pub messages_sent: i32,
pub messages_received: i32,
pub signature_cache: MessageCache,
pub message_validator: LastSeenMessagesValidator,
pub chat_session: Option<RemoteChatSession>,
pub message_chain: Option<SignedMessageChain>,
chat_spam_throttler: TickThrottler,
command_spam_throttler: TickThrottler,
}Expand description
All chat-related state for a player.
Stored behind a single SyncMutex on Player. The fields were previously
individual atomics/mutexes but are always accessed within short critical
sections per-player, so a single lock is simpler with no real contention cost.
Fields§
§messages_sent: i32Counter for chat messages sent BY this player.
messages_received: i32Counter for chat messages received BY this player.
signature_cache: MessageCacheMessage signature cache for tracking chat messages.
message_validator: LastSeenMessagesValidatorValidator for client acknowledgements of messages we’ve sent.
chat_session: Option<RemoteChatSession>Remote chat session containing the player’s public key (if signed chat is enabled).
message_chain: Option<SignedMessageChain>Message chain state for tracking signed message sequence.
chat_spam_throttler: TickThrottler§command_spam_throttler: TickThrottlerImplementations§
Auto Trait Implementations§
impl Freeze for ChatState
impl RefUnwindSafe for ChatState
impl Send for ChatState
impl Sync for ChatState
impl Unpin for ChatState
impl UnsafeUnpin for ChatState
impl UnwindSafe for ChatState
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
§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<>>