pub struct TransportPacket { /* private fields */ }Expand description
Exact bytes sent over an agent transport.
A packet contains the four-byte length prefix followed by one binary frame:
[len: u32 BE][id: u32 BE][flags: u8][body...].
Implementations§
Source§impl TransportPacket
impl TransportPacket
Sourcepub fn from_bytes(bytes: impl Into<Vec<u8>>) -> AgentClientResult<Self>
pub fn from_bytes(bytes: impl Into<Vec<u8>>) -> AgentClientResult<Self>
Validate and wrap exact wire bytes.
The input must contain exactly one complete transport packet. It may be used by unchecked write paths, but it is still structurally validated so callers cannot accidentally concatenate packets or pass a truncated frame.
Sourcepub fn from_frame(frame: &RawFrame) -> AgentClientResult<Self>
pub fn from_frame(frame: &RawFrame) -> AgentClientResult<Self>
Create a packet from a structured raw frame.
The frame body is left opaque; this method only applies the binary transport framing.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Consume the packet and return its exact transport bytes.
Trait Implementations§
Source§impl Clone for TransportPacket
impl Clone for TransportPacket
Source§fn clone(&self) -> TransportPacket
fn clone(&self) -> TransportPacket
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 moreAuto Trait Implementations§
impl Freeze for TransportPacket
impl RefUnwindSafe for TransportPacket
impl Send for TransportPacket
impl Sync for TransportPacket
impl Unpin for TransportPacket
impl UnsafeUnpin for TransportPacket
impl UnwindSafe for TransportPacket
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