pub trait Framer {
// Required methods
fn enclose(&mut self, buf: &mut Vec<u8>);
fn extract(&mut self, buf: &[u8]) -> Option<Frame>;
}Expand description
Enclosing and extracting frames in a buffer.
Required Methods§
Sourcefn enclose(&mut self, buf: &mut Vec<u8>)
fn enclose(&mut self, buf: &mut Vec<u8>)
Enclose a frame in the given buffer.
All initialized bytes in buf (buf[0..buf.len()]) are valid and
required to be enclosed. All modifications should happen in-place; one
can use slice::copy_within or a temporary buffer if prepending data
is necessary.