pub struct Encoder(/* private fields */);Expand description
Encodes a stream’s frame payloads into one shared DEFLATE window, one self-delimited slice per frame. Hold one per stream; create a fresh one for each independent stream.
Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn new() -> Self
pub fn new() -> Self
Start a fresh encoder with a cold window at DEFAULT_LEVEL.
Sourcepub fn with_level(level: u32) -> Self
pub fn with_level(level: u32) -> Self
Start a fresh encoder with a cold window at the given DEFLATE level (0..=9; higher is
smaller and slower). Values above 9 are clamped.
Sourcepub fn frame(&mut self, payload: &[u8]) -> Bytes
pub fn frame(&mut self, payload: &[u8]) -> Bytes
Compress the next frame’s payload, returning its slice of the stream: the DEFLATE bytes minus
the fixed sync-flush marker. Empty in yields empty out. Later frames reuse earlier ones as
context, so slices must be produced (and later decoded) in frame order.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Encoder
impl RefUnwindSafe for Encoder
impl Send for Encoder
impl Sync for Encoder
impl Unpin for Encoder
impl UnsafeUnpin for Encoder
impl UnwindSafe for Encoder
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