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
sourceimpl<W: Write> FrameEncoder<W>
impl<W: Write> FrameEncoder<W>
sourcepub fn new(wtr: W) -> FrameEncoder<W>ⓘNotable traits for FrameEncoder<W>impl<W: Write> Write for FrameEncoder<W>
pub fn new(wtr: W) -> FrameEncoder<W>ⓘNotable traits for FrameEncoder<W>impl<W: Write> Write for 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
sourceimpl<W: Debug + Write> Debug for FrameEncoder<W>
impl<W: Debug + Write> Debug for FrameEncoder<W>
sourceimpl<W: Write> Drop for FrameEncoder<W>
impl<W: Write> Drop for FrameEncoder<W>
sourceimpl<W: Write> Write for FrameEncoder<W>
impl<W: Write> Write for FrameEncoder<W>
sourcefn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. Read more
sourcefn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
sourcefn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)Determines if this Write
r has an efficient write_vectored
implementation. Read more
1.0.0 · sourcefn 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
sourcefn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more