pub struct Envelope<T> {
pub seq: u64,
pub ack: Option<u64>,
pub timestamp: u64,
pub payload: T,
}Expand description
Message envelope wrapping any payload with delivery metadata.
Used for reliable message delivery with:
- Sequence numbers for ordering
- Acknowledgments for delivery confirmation
- Timestamps for latency measurement and clock sync
Fields§
§seq: u64Monotonically increasing sequence number (per connection). Server and client maintain separate sequences.
ack: Option<u64>Piggyback acknowledgment of the last received sequence number. Allows confirming receipt without a separate ack message.
timestamp: u64Server timestamp in milliseconds since Unix epoch. Clients can use this for latency calculation and clock sync.
payload: TThe actual message payload.
Implementations§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Envelope<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Envelope<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for Envelope<T>where
T: Freeze,
impl<T> RefUnwindSafe for Envelope<T>where
T: RefUnwindSafe,
impl<T> Send for Envelope<T>where
T: Send,
impl<T> Sync for Envelope<T>where
T: Sync,
impl<T> Unpin for Envelope<T>where
T: Unpin,
impl<T> UnwindSafe for Envelope<T>where
T: UnwindSafe,
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