Expand description
Runtime wrapper around either a Write or a [Write + Seek] trait object
which supports querying for seek support.
Variants
NonSeekable(WO, u64)
A writer which does not support seeking, e.g. stdout.
Seekable(WS)
A writer which does support seeking, e.g. a file or in-memory buffer.
Implementations
sourceimpl<WS: Write + Seek> Writer<Cursor<Vec<u8>>, WS>
impl<WS: Write + Seek> Writer<Cursor<Vec<u8>>, WS>
sourcepub fn from_seekable(inner: WS) -> Self
pub fn from_seekable(inner: WS) -> Self
sourceimpl<WO: Write, WS: Write + Seek> Writer<WO, WS>
impl<WO: Write, WS: Write + Seek> Writer<WO, WS>
sourcepub fn is_seekable(&self) -> bool
pub fn is_seekable(&self) -> bool
Returns whether the Writer can seek within the source.
sourcepub fn non_seekable_object(&self) -> Option<(&WO, u64)>
pub fn non_seekable_object(&self) -> Option<(&WO, u64)>
Returns a reference to the non-seekable object whether is present.
sourcepub fn seekable_object(&self) -> Option<&WS>
pub fn seekable_object(&self) -> Option<&WS>
Returns a reference to the seekable object whether is present.
Trait Implementations
sourceimpl<WO: Write, WS: Write + Seek> Seek for Writer<WO, WS>
impl<WO: Write, WS: Write + Seek> Seek for Writer<WO, WS>
sourcefn seek(&mut self, seek: SeekFrom) -> Result<u64>
fn seek(&mut self, seek: SeekFrom) -> Result<u64>
Seek to an offset, in bytes, in a stream. Read more
1.55.0 · sourcefn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
Rewind to the beginning of a stream. Read more
sourceimpl<WO: Write, WS: Write + Seek> Write for Writer<WO, WS>
impl<WO: Write, WS: Write + Seek> Write for Writer<WO, WS>
sourcefn write(&mut self, bytes: &[u8]) -> Result<usize>
fn write(&mut self, bytes: &[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 Writer 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<WO, WS> RefUnwindSafe for Writer<WO, WS> where
WO: RefUnwindSafe,
WS: RefUnwindSafe,
impl<WO, WS> Send for Writer<WO, WS> where
WO: Send,
WS: Send,
impl<WO, WS> Sync for Writer<WO, WS> where
WO: Sync,
WS: Sync,
impl<WO, WS> Unpin for Writer<WO, WS> where
WO: Unpin,
WS: Unpin,
impl<WO, WS> UnwindSafe for Writer<WO, WS> where
WO: UnwindSafe,
WS: 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