pub struct Encoder<'a> { /* private fields */ }
Expand description
An encoder that compresses data using the Zstandard algorithm.
Implementations§
Source§impl Encoder<'static>
impl Encoder<'static>
Sourcepub fn new(level: i32) -> (Self, Receiver<Vec<u8>>)
pub fn new(level: i32) -> (Self, Receiver<Vec<u8>>)
Creates a new Encoder
with the given compression level and returns a receiver
for the compressed data.
The Encoder
will compress data in chunks and send the compressed chunks
over the returned mpsc::Receiver
.
Sourcepub async fn compress(&mut self, bytes: &[u8]) -> Result<(), Error>
pub async fn compress(&mut self, bytes: &[u8]) -> Result<(), Error>
Compresses the given bytes and sends the compressed data over the channel.
This method compresses the input data in chunks, using a thread-local buffer to store the compressed data. The compressed chunks are then sent over the channel to the receiver.
Auto Trait Implementations§
impl<'a> Freeze for Encoder<'a>
impl<'a> !RefUnwindSafe for Encoder<'a>
impl<'a> Send for Encoder<'a>
impl<'a> !Sync for Encoder<'a>
impl<'a> Unpin for Encoder<'a>
impl<'a> !UnwindSafe for Encoder<'a>
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more