pub struct Frame {
pub header: FrameHeader,
pub payload: Bytes,
}Expand description
A complete frame with header and payload.
Fields§
§header: FrameHeaderFrame header.
payload: BytesPayload bytes.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn encode_to_bytes(&self) -> Bytes
pub fn encode_to_bytes(&self) -> Bytes
Encodes the frame to a new byte buffer.
Sourcepub fn decode(buf: &mut BytesMut) -> WireResult<Option<Self>>
pub fn decode(buf: &mut BytesMut) -> WireResult<Option<Self>>
Attempts to decode a frame from a byte buffer.
Returns Ok(Some(frame)) if a complete frame was decoded.
Returns Ok(None) if more bytes are needed.
Returns Err if the frame is invalid.
On success, the consumed bytes are removed from the buffer.
Sourcepub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Returns the total size of the frame in bytes.
Trait Implementations§
impl Eq for Frame
impl StructuralPartialEq for Frame
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