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]
impl<W: Write> Writer<W>
ⓘImportant traits for Writer<W>pub fn new(wtr: W) -> Writer<W>
[src]
pub fn new(wtr: W) -> Writer<W>
Create a new writer for streaming Snappy compression.
pub fn into_inner(self) -> Result<W, IntoInnerError<Writer<W>>>
[src]
pub 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.
pub fn get_ref(&self) -> &W
[src]
pub fn get_ref(&self) -> &W
Gets a reference to the underlying writer in this encoder.
Trait Implementations
impl<W: Write> Drop for Writer<W>
[src]
impl<W: Write> Drop for Writer<W>
impl<W: Write> Write for Writer<W>
[src]
impl<W: Write> Write for Writer<W>
fn write(&mut self, buf: &[u8]) -> Result<usize>
[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<()>
[src]
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[src]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
Creates a "by reference" adaptor for this instance of Write
. Read more