Struct AllowStdIo

struct AllowStdIo<T>(_)

A simple wrapper type which allows types which implement only implement std::io::Read or std::io::Write to be used in contexts which expect an AsyncRead or AsyncWrite.

If these types issue an error with the kind io::ErrorKind::WouldBlock, it is expected that they will notify the current task on readiness. Synchronous std types should not issue errors of this kind and are safe to use in this context. However, using these types with AllowStdIo will cause the event loop to block, so they should be used with care.

Implementations

impl<T> AllowStdIo<T>

fn new(io: T) -> Self

Creates a new AllowStdIo from an existing IO object.

fn get_ref(self: &Self) -> &T

Returns a reference to the contained IO object.

fn get_mut(self: &mut Self) -> &mut T

Returns a mutable reference to the contained IO object.

fn into_inner(self: Self) -> T

Consumes self and returns the contained IO object.

impl<R> AsyncBufReadExt for AllowStdIo<T>

impl<R> AsyncReadExt for AllowStdIo<T>

impl<S> AsyncSeekExt for AllowStdIo<T>

impl<T> Any for AllowStdIo<T>

fn type_id(self: &Self) -> TypeId

impl<T> AsyncBufRead for AllowStdIo<T>

fn poll_fill_buf(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<&[u8]>>
fn consume(self: Pin<&mut Self>, amt: usize)

impl<T> AsyncRead for AllowStdIo<T>

fn poll_read(self: Pin<&mut Self>, _: &mut Context<'_>, buf: &mut [u8]) -> Poll<Result<usize>>
fn poll_read_vectored(self: Pin<&mut Self>, _: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>]) -> Poll<Result<usize>>

impl<T> AsyncSeek for AllowStdIo<T>

fn poll_seek(self: Pin<&mut Self>, _: &mut Context<'_>, pos: SeekFrom) -> Poll<Result<u64>>

impl<T> AsyncWrite for AllowStdIo<T>

fn poll_write(self: Pin<&mut Self>, _: &mut Context<'_>, buf: &[u8]) -> Poll<Result<usize>>
fn poll_write_vectored(self: Pin<&mut Self>, _: &mut Context<'_>, bufs: &[IoSlice<'_>]) -> Poll<Result<usize>>
fn poll_flush(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<()>>
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>

impl<T> Borrow for AllowStdIo<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for AllowStdIo<T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> BufRead for AllowStdIo<T>

fn fill_buf(self: &mut Self) -> Result<&[u8]>
fn consume(self: &mut Self, amt: usize)

impl<T> CloneToUninit for AllowStdIo<T>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> Freeze for AllowStdIo<T>

impl<T> From for AllowStdIo<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Read for AllowStdIo<T>

fn read(self: &mut Self, buf: &mut [u8]) -> Result<usize>
fn read_vectored(self: &mut Self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
fn read_to_end(self: &mut Self, buf: &mut Vec<u8>) -> Result<usize>
fn read_to_string(self: &mut Self, buf: &mut String) -> Result<usize>
fn read_exact(self: &mut Self, buf: &mut [u8]) -> Result<()>

impl<T> RefUnwindSafe for AllowStdIo<T>

impl<T> Seek for AllowStdIo<T>

fn seek(self: &mut Self, pos: SeekFrom) -> Result<u64>

impl<T> Send for AllowStdIo<T>

impl<T> StructuralPartialEq for AllowStdIo<T>

impl<T> Sync for AllowStdIo<T>

impl<T> ToOwned for AllowStdIo<T>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> Unpin for AllowStdIo<T>

impl<T> UnsafeUnpin for AllowStdIo<T>

impl<T> UnwindSafe for AllowStdIo<T>

impl<T> Write for AllowStdIo<T>

fn write(self: &mut Self, buf: &[u8]) -> Result<usize>
fn write_vectored(self: &mut Self, bufs: &[IoSlice<'_>]) -> Result<usize>
fn flush(self: &mut Self) -> Result<()>
fn write_all(self: &mut Self, buf: &[u8]) -> Result<()>
fn write_fmt(self: &mut Self, fmt: Arguments<'_>) -> Result<()>

impl<T, U> Into for AllowStdIo<T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for AllowStdIo<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for AllowStdIo<T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: $crate::clone::Clone> Clone for AllowStdIo<T>

fn clone(self: &Self) -> AllowStdIo<T>

impl<T: $crate::cmp::Eq> Eq for AllowStdIo<T>

impl<T: $crate::cmp::Ord> Ord for AllowStdIo<T>

fn cmp(self: &Self, other: &AllowStdIo<T>) -> Ordering

impl<T: $crate::cmp::PartialEq> PartialEq for AllowStdIo<T>

fn eq(self: &Self, other: &AllowStdIo<T>) -> bool

impl<T: $crate::cmp::PartialOrd> PartialOrd for AllowStdIo<T>

fn partial_cmp(self: &Self, other: &AllowStdIo<T>) -> Option<Ordering>

impl<T: $crate::fmt::Debug> Debug for AllowStdIo<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T: $crate::hash::Hash> Hash for AllowStdIo<T>

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl<T: $crate::marker::Copy> Copy for AllowStdIo<T>

impl<W> AsyncWriteExt for AllowStdIo<T>