Struct snap::Writer
[−]
[src]
pub struct Writer<W: Write> { /* fields omitted */ }
A writer for compressing a Snappy stream.
This Writer
wraps any other writer that implements io::Write
. Bytes
written to this writer are compressed using the
Snappy frame format
(file extension sz
, MIME type application/x-snappy-framed
).
Writes are buffered automatically, so there's no need to wrap the given
writer in a std::io::BufWriter
.
The writer will be flushed automatically when it is dropped. If an error occurs, it is ignored.
Methods
impl<W: Write> Writer<W>
[src]
fn new(wtr: W) -> Writer<W>
Create a new writer for streaming Snappy compression.
fn into_inner(self) -> Result<W, IntoInnerError<Writer<W>>>
Returns the underlying stream, consuming and flushing this writer.
If flushing the writer caused an error, then an IntoInnerError
is
returned, which contains both the writer and the original writer.
Trait Implementations
impl<W: Write> Drop for Writer<W>
[src]
impl<W: Write> Write for Writer<W>
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this object, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0
Creates a "by reference" adaptor for this instance of Write
. Read more