pub struct SignedMessageChain {
next_link: Option<SignedMessageLink>,
last_timestamp: SystemTime,
}Expand description
Manages the message chain state for a player.
Equivalent to SignedMessageChain in Minecraft.
Fields§
§next_link: Option<SignedMessageLink>The next expected link in the chain (None if chain is broken)
last_timestamp: SystemTimeTimestamp of the last message (for ordering validation)
Implementations§
Source§impl SignedMessageChain
impl SignedMessageChain
Sourcepub const fn next_link(&self) -> Option<&SignedMessageLink>
pub const fn next_link(&self) -> Option<&SignedMessageLink>
Gets the current link if the chain is not broken
Sourcepub const fn break_chain(&mut self)
pub const fn break_chain(&mut self)
Breaks the chain (sets next_link to None)
Sourcepub fn validate_and_advance(
&mut self,
body: &SignedMessageBody,
) -> Result<SignedMessageLink, ChainError>
pub fn validate_and_advance( &mut self, body: &SignedMessageBody, ) -> Result<SignedMessageLink, ChainError>
Validates and advances the chain with a new message.
Returns the link that was used for this message.
§Errors
Returns ChainError if validation fails
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SignedMessageChain
impl RefUnwindSafe for SignedMessageChain
impl Send for SignedMessageChain
impl Sync for SignedMessageChain
impl Unpin for SignedMessageChain
impl UnsafeUnpin for SignedMessageChain
impl UnwindSafe for SignedMessageChain
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<>>