pub struct TeleportState {
pub awaiting_position: Option<DVec3>,
pub teleport_id: i32,
pub teleport_time: i32,
}Expand description
Tracks the state of a pending server-initiated teleport.
Fields§
§awaiting_position: Option<DVec3>Position we’re waiting for the client to confirm.
Some means we should reject movement packets until confirmed.
teleport_id: i32Incrementing teleport ID counter (wraps at i32::MAX).
teleport_time: i32Tick count when last teleport was sent (for timeout/resend).
Implementations§
Source§impl TeleportState
impl TeleportState
pub const fn new() -> Self
Sourcepub const fn is_awaiting(&self) -> bool
pub const fn is_awaiting(&self) -> bool
Returns true if we’re waiting for a teleport confirmation.
Sourcepub const fn next_id(&mut self) -> i32
pub const fn next_id(&mut self) -> i32
Advances the teleport ID, wrapping at i32::MAX. Returns the new ID.
Sourcepub const fn try_accept(&mut self, id: i32) -> Option<DVec3>
pub const fn try_accept(&mut self, id: i32) -> Option<DVec3>
Accepts the teleport if the ID matches.
Returns the confirmed position, or None if the ID doesn’t match.
Auto Trait Implementations§
impl Freeze for TeleportState
impl RefUnwindSafe for TeleportState
impl Send for TeleportState
impl Sync for TeleportState
impl Unpin for TeleportState
impl UnsafeUnpin for TeleportState
impl UnwindSafe for TeleportState
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<>>