[−][src]Struct zstd::stream::zio::Writer
Implements the Write
API around an Operation
.
This can be used to wrap a raw in-memory operation in a write-focused API.
It can be used with either compression or decompression, and forwards the
output to a wrapped Write
.
Methods
impl<W, D> Writer<W, D> where
W: Write,
D: Operation,
[src]
W: Write,
D: Operation,
pub fn new(writer: W, operation: D) -> Self
[src]
Creates a new Writer
.
All output from the given operation will be forwarded to writer
.
pub fn finish(&mut self) -> Result<()>
[src]
Ends the stream.
This must be called after all data has been written to finish the stream.
If you forget to call this and just drop the Writer
, you will have
an incomplete output.
Keep calling it until it returns Ok(())
, then don't call it again.
pub fn into_inner(self) -> (W, D)
[src]
Return the wrapped Writer
and Operation
.
Careful: if you call this before calling Writer::finish()
, the
output may be incomplete.
pub fn writer(&self) -> &W
[src]
Gives a reference to the inner writer.
pub fn writer_mut(&mut self) -> &mut W
[src]
Gives a mutable reference to the inner writer.
Trait Implementations
impl<W, D> Write for Writer<W, D> where
W: Write,
D: Operation,
[src]
W: Write,
D: Operation,
fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
fn flush(&mut self) -> Result<()>
[src]
fn write_vectored(&mut self, bufs: &[IoVec]) -> Result<usize, Error>
[src]
iovec
)Like write
, except that it writes from a slice of buffers. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
Attempts to write an entire buffer into this writer. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Creates a "by reference" adaptor for this instance of Write
. Read more
Auto Trait Implementations
impl<W, D> Send for Writer<W, D> where
D: Send,
W: Send,
D: Send,
W: Send,
impl<W, D> Sync for Writer<W, D> where
D: Sync,
W: Sync,
D: Sync,
W: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,