pub struct Frame {
pub header: Header,
pub payload: Bytes,
}Expand description
A complete protocol frame.
Fields§
§header: HeaderDecoded header.
payload: BytesPayload bytes (zero-copy via bytes::Bytes).
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn from_parts(header: Header, payload: &[u8]) -> Self
pub fn from_parts(header: Header, payload: &[u8]) -> Self
Create a frame from header and raw bytes (copies data).
Sourcepub fn payload_bytes(&self) -> Bytes
pub fn payload_bytes(&self) -> Bytes
Get a clone of the payload as Bytes (cheap, zero-copy).
Sourcepub fn payload_len(&self) -> usize
pub fn payload_len(&self) -> usize
Get the payload length.
Sourcepub fn request_id(&self) -> u32
pub fn request_id(&self) -> u32
Get the request ID.
Sourcepub fn is_response(&self) -> bool
pub fn is_response(&self) -> bool
Check if this is a response.
Sourcepub fn is_stream_end(&self) -> bool
pub fn is_stream_end(&self) -> bool
Check if this is the final stream chunk.
Sourcepub fn is_to_parent(&self) -> bool
pub fn is_to_parent(&self) -> bool
Check if direction is to parent.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
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