pub struct StreamEncoder(/* private fields */);Expand description
Encoder for one direction of one logical session.
Implementations§
Source§impl StreamEncoder
impl StreamEncoder
Sourcepub fn new(encoding: StreamEncoding) -> Result<Self, StreamEncodingError>
pub fn new(encoding: StreamEncoding) -> Result<Self, StreamEncodingError>
Fresh encoder at the default level: deflate 9, zstd 3.
Sourcepub fn with_level(
encoding: StreamEncoding,
level: i32,
) -> Result<Self, StreamEncodingError>
pub fn with_level( encoding: StreamEncoding, level: i32, ) -> Result<Self, StreamEncodingError>
Fresh encoder at a sender-chosen level. The decoder needs only the
encoding. Identity ignores the level.
Sourcepub fn encode(
&mut self,
input: &[u8],
mode: EncodeMode,
output: &mut [u8],
) -> Result<EncodeProgress, StreamEncodingError>
pub fn encode( &mut self, input: &[u8], mode: EncodeMode, output: &mut [u8], ) -> Result<EncodeProgress, StreamEncodingError>
Encode a prefix of input into at most output.len() bytes.
Write takes plaintext, Flush completes all plaintext written so far
so the peer can decode it from the wire bytes alone (every batch end),
and End writes the end mark, after which the encoder takes nothing
more. Callers repeat a step with fresh output room until it is done;
a flushing step needs at least ENCODE_MIN_OUTPUT bytes of room.
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Whether this encoder passes plaintext through unchanged.
Auto Trait Implementations§
impl Freeze for StreamEncoder
impl RefUnwindSafe for StreamEncoder
impl Send for StreamEncoder
impl Sync for StreamEncoder
impl Unpin for StreamEncoder
impl UnsafeUnpin for StreamEncoder
impl UnwindSafe for StreamEncoder
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