Struct AllowStdIo
pub struct AllowStdIo<T>(/* private field */);
A simple wrapper type which allows types which implement only
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) -> SelfCreates a new
AllowStdIofrom an existing IO object.fn get_ref(&self) -> &TReturns a reference to the contained IO object.
fn get_mut(&mut self) -> &mut TReturns a mutable reference to the contained IO object.
fn into_inner(self) -> TConsumes self and returns the contained IO object.
Trait Implementations
impl<T> AsyncBufRead for AllowStdIo<T>
where
T: BufRead,
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>
where
T: Read,
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>
where
T: Seek,
fn poll_seek(self: Pin<&mut Self>, &mut Context<'_>, pos: SeekFrom) -> Poll<Result<u64>>
impl<T> AsyncWrite for AllowStdIo<T>
where
T: Write,
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> BufRead for AllowStdIo<T>
where
T: BufRead,
fn fill_buf(&mut self) -> Result<&[u8]>fn consume(&mut self, amt: usize)
impl<T> Read for AllowStdIo<T>
where
T: Read,
fn read(&mut self, buf: &mut [u8]) -> Result<usize>fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>fn read_to_string(&mut self, buf: &mut String) -> Result<usize>fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
impl<T> Seek for AllowStdIo<T>
where
T: Seek,
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
impl<T> Unpin for AllowStdIo<T>
impl<T> Write for AllowStdIo<T>
where
T: Write,
fn write(&mut self, buf: &[u8]) -> Result<usize>fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>fn flush(&mut self) -> Result<()>fn write_all(&mut self, buf: &[u8]) -> Result<()>fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<()>
impl<T: Clone> Clone for AllowStdIo<T>
fn clone(&self) -> AllowStdIo<T>
impl<T: Copy> Copy for AllowStdIo<T>
impl<T: Debug> Debug for AllowStdIo<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T: Eq> Eq for AllowStdIo<T>
impl<T: Hash> Hash for AllowStdIo<T>
fn hash<__H: Hasher>(&self, state: &mut __H)
impl<T: Ord> Ord for AllowStdIo<T>
fn cmp(&self, other: &AllowStdIo<T>) -> Ordering
impl<T: PartialEq> PartialEq for AllowStdIo<T>
fn eq(&self, other: &AllowStdIo<T>) -> bool
impl<T: PartialEq> StructuralPartialEq for AllowStdIo<T>
impl<T: PartialOrd> PartialOrd for AllowStdIo<T>
fn partial_cmp(&self, other: &AllowStdIo<T>) -> Option<Ordering>
Auto Trait Implementations
impl<T> Freeze for AllowStdIo<T>
where
T: Freeze,
impl<T> RefUnwindSafe for AllowStdIo<T>
where
T: RefUnwindSafe,
impl<T> Send for AllowStdIo<T>
where
T: Send,
impl<T> Sync for AllowStdIo<T>
where
T: Sync,
impl<T> UnsafeUnpin for AllowStdIo<T>
where
T: UnsafeUnpin,
impl<T> UnwindSafe for AllowStdIo<T>
where
T: UnwindSafe,
Blanket Implementations
impl<R> AsyncBufReadExt for AllowStdIo<T>
where
R: AsyncBufRead + ?Sized,
impl<R> AsyncReadExt for AllowStdIo<T>
where
R: AsyncRead + ?Sized,
impl<S> AsyncSeekExt for AllowStdIo<T>
where
S: AsyncSeek + ?Sized,
impl<T> Any for AllowStdIo<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for AllowStdIo<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for AllowStdIo<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for AllowStdIo<T>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for AllowStdIo<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for AllowStdIo<T>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for AllowStdIo<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for AllowStdIo<T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for AllowStdIo<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>