Skip to main content

FrameWrite

Trait FrameWrite 

Source
pub trait FrameWrite {
    type Error;

    // Required methods
    fn is_empty(&self) -> bool;
    fn push(&mut self, data: &[u8]) -> Result<(), PushError>;
    fn finish(&mut self) -> Result<&[u8], Self::Error>;
}
Expand description

Accumulates packets into a transfer frame.

Owns the frame buffer internally. push() writes packet data at the current offset. finish() stamps the header and returns a borrow of the completed frame.

Required Associated Types§

Source

type Error

Error type for frame construction.

Required Methods§

Source

fn is_empty(&self) -> bool

Returns true if no packets have been pushed yet.

Source

fn push(&mut self, data: &[u8]) -> Result<(), PushError>

Push a packet into the frame at the current offset.

Source

fn finish(&mut self) -> Result<&[u8], Self::Error>

Stamp the frame header and return the finished frame. Resets internal state for the next frame.

Implementors§