pub struct StdWriteAdapter<'a, 'b, W> { /* private fields */ }Available on crate feature
io only.Expand description
Adapts an implementor of AsyncWrite to be usable in some context requiring std::io::Write
Important: this adapter is limited to a specific scenario where the calling code supports
restarting. In particular, the calling code MUST NOT call the write_all method on the writer.
Implementations§
Source§impl<'a, 'b, W: AsyncWrite> StdWriteAdapter<'a, 'b, W>
impl<'a, 'b, W: AsyncWrite> StdWriteAdapter<'a, 'b, W>
Sourcepub fn new_assuming_correct_usage(writer: W, cx: &'a mut Context<'b>) -> Self
pub fn new_assuming_correct_usage(writer: W, cx: &'a mut Context<'b>) -> Self
Constructs the adapter.
This method produces a restricted implementation of std::io::Write and may only be
passed to functions that properly implement restarting and don’t block. This property is
neither checked by the type system nor required by the Write trait and thus it has to be
explicitly guaranteed by each function that takes the returned value as argument.
Trait Implementations§
Source§impl<'a, 'b, W: Debug> Debug for StdWriteAdapter<'a, 'b, W>
impl<'a, 'b, W: Debug> Debug for StdWriteAdapter<'a, 'b, W>
Source§impl<'a, 'b, W: AsyncWrite + Unpin> Write for StdWriteAdapter<'a, 'b, W>
impl<'a, 'b, W: AsyncWrite + Unpin> Write for StdWriteAdapter<'a, 'b, W>
Source§fn write_all(&mut self, _: &[u8]) -> Result<()>
fn write_all(&mut self, _: &[u8]) -> Result<()>
Calling this method would be wrong therefore it always panics.
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)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<'a, 'b, W> Freeze for StdWriteAdapter<'a, 'b, W>where
W: Freeze,
impl<'a, 'b, W> RefUnwindSafe for StdWriteAdapter<'a, 'b, W>where
W: RefUnwindSafe,
impl<'a, 'b, W> !Send for StdWriteAdapter<'a, 'b, W>
impl<'a, 'b, W> !Sync for StdWriteAdapter<'a, 'b, W>
impl<'a, 'b, W> Unpin for StdWriteAdapter<'a, 'b, W>where
W: Unpin,
impl<'a, 'b, W> UnsafeUnpin for StdWriteAdapter<'a, 'b, W>where
W: UnsafeUnpin,
impl<'a, 'b, W> !UnwindSafe for StdWriteAdapter<'a, 'b, W>
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