Struct snap::write::FrameEncoder
source · pub struct FrameEncoder<W: Write> { /* private fields */ }
Expand description
A writer for compressing a Snappy stream.
This FrameEncoder
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.
Implementations§
source§impl<W: Write> FrameEncoder<W>
impl<W: Write> FrameEncoder<W>
sourcepub fn new(wtr: W) -> FrameEncoder<W> ⓘ
pub fn new(wtr: W) -> FrameEncoder<W> ⓘ
Create a new writer for streaming Snappy compression.
sourcepub fn into_inner(self) -> Result<W, IntoInnerError<FrameEncoder<W>>>
pub fn into_inner(self) -> Result<W, IntoInnerError<FrameEncoder<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§
source§impl<W: Write> Drop for FrameEncoder<W>
impl<W: Write> Drop for FrameEncoder<W>
source§impl<W: Write> Write for FrameEncoder<W>
impl<W: Write> Write for FrameEncoder<W>
source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Writes a buffer into this writer, returning how many bytes were written. Read more
source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)1.0.0 · source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl<W> Freeze for FrameEncoder<W>where
W: Freeze,
impl<W> RefUnwindSafe for FrameEncoder<W>where
W: RefUnwindSafe,
impl<W> Send for FrameEncoder<W>where
W: Send,
impl<W> Sync for FrameEncoder<W>where
W: Sync,
impl<W> Unpin for FrameEncoder<W>where
W: Unpin,
impl<W> UnwindSafe for FrameEncoder<W>where
W: UnwindSafe,
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