Struct grafix_toolbox::uses::Async::io::AssertAsync [−]
pub struct AssertAsync<T>(_);
Expand description
Asserts that a type implementing std::io traits can be used as an async type.
The underlying I/O handle should never block nor return the ErrorKind::WouldBlock error.
This is usually the case for in-memory buffered I/O.
Examples
use futures_lite::io::{AssertAsync, AsyncReadExt}; let reader: &[u8] = b"hello"; let mut async_reader = AssertAsync::new(reader); let mut contents = String::new(); // This line works in async manner - note that there is await: async_reader.read_to_string(&mut contents).await?;
Implementations
impl<T> AssertAsync<T>
impl<T> AssertAsync<T>pub fn new(io: T) -> AssertAsync<T>
pub fn new(io: T) -> AssertAsync<T>Gets a reference to the inner I/O handle.
Examples
use futures_lite::io::AssertAsync; let reader: &[u8] = b"hello"; let async_reader = AssertAsync::new(reader); let r = async_reader.get_ref();
Gets a mutable reference to the inner I/O handle.
Examples
use futures_lite::io::AssertAsync; let reader: &[u8] = b"hello"; let mut async_reader = AssertAsync::new(reader); let r = async_reader.get_mut();
pub fn into_inner(self) -> T
pub fn into_inner(self) -> TExtracts the inner I/O handle.
Examples
use futures_lite::io::AssertAsync; let reader: &[u8] = b"hello"; let async_reader = AssertAsync::new(reader); let inner = async_reader.into_inner();
Trait Implementations
impl<T> AsyncRead for AssertAsync<T> where
T: Read,
impl<T> AsyncRead for AssertAsync<T> where
T: Read, Attempt to read from the AsyncRead into buf. Read more
pub fn poll_read_vectored(
self: Pin<&mut AssertAsync<T>>,
&mut Context<'_>,
bufs: &mut [IoSliceMut<'_>]
) -> Poll<Result<usize, Error>>
pub fn poll_read_vectored(
self: Pin<&mut AssertAsync<T>>,
&mut Context<'_>,
bufs: &mut [IoSliceMut<'_>]
) -> Poll<Result<usize, Error>>Attempt to read from the AsyncRead into bufs using vectored
IO operations. Read more
impl<T> AsyncSeek for AssertAsync<T> where
T: Seek,
impl<T> AsyncSeek for AssertAsync<T> where
T: Seek, impl<T> AsyncWrite for AssertAsync<T> where
T: Write,
impl<T> AsyncWrite for AssertAsync<T> where
T: Write, Attempt to write bytes from buf into the object. Read more
Attempt to write bytes from bufs into the object using vectored
IO operations. Read more
pub fn poll_flush(
self: Pin<&mut AssertAsync<T>>,
&mut Context<'_>
) -> Poll<Result<(), Error>>
pub fn poll_flush(
self: Pin<&mut AssertAsync<T>>,
&mut Context<'_>
) -> Poll<Result<(), Error>>Attempt to flush the object, ensuring that any buffered data reach their destination. Read more
pub fn poll_close(
self: Pin<&mut AssertAsync<T>>,
cx: &mut Context<'_>
) -> Poll<Result<(), Error>>
pub fn poll_close(
self: Pin<&mut AssertAsync<T>>,
cx: &mut Context<'_>
) -> Poll<Result<(), Error>>Attempt to close the object. Read more
impl<T> Clone for AssertAsync<T> where
T: Clone,
impl<T> Clone for AssertAsync<T> where
T: Clone, pub fn clone(&self) -> AssertAsync<T>
pub fn clone(&self) -> AssertAsync<T>Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
impl<T> Debug for AssertAsync<T> where
T: Debug,
impl<T> Debug for AssertAsync<T> where
T: Debug, impl<T> Hash for AssertAsync<T> where
T: Hash,
impl<T> Hash for AssertAsync<T> where
T: Hash, impl<T> Ord for AssertAsync<T> where
T: Ord,
impl<T> Ord for AssertAsync<T> where
T: Ord, pub fn cmp(&self, other: &AssertAsync<T>) -> Ordering
pub fn cmp(&self, other: &AssertAsync<T>) -> OrderingCompares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
impl<T> PartialEq<AssertAsync<T>> for AssertAsync<T> where
T: PartialEq<T>,
impl<T> PartialEq<AssertAsync<T>> for AssertAsync<T> where
T: PartialEq<T>, pub fn eq(&self, other: &AssertAsync<T>) -> bool
pub fn eq(&self, other: &AssertAsync<T>) -> boolThis method tests for self and other values to be equal, and is used
by ==. Read more
pub fn ne(&self, other: &AssertAsync<T>) -> bool
pub fn ne(&self, other: &AssertAsync<T>) -> boolThis method tests for !=.
impl<T> PartialOrd<AssertAsync<T>> for AssertAsync<T> where
T: PartialOrd<T>,
impl<T> PartialOrd<AssertAsync<T>> for AssertAsync<T> where
T: PartialOrd<T>, pub fn partial_cmp(&self, other: &AssertAsync<T>) -> Option<Ordering>
pub fn partial_cmp(&self, other: &AssertAsync<T>) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
impl<T> Copy for AssertAsync<T> where
T: Copy, impl<T> Eq for AssertAsync<T> where
T: Eq, impl<T> StructuralEq for AssertAsync<T>impl<T> StructuralPartialEq for AssertAsync<T>impl<T> Unpin for AssertAsync<T>Auto Trait Implementations
impl<T> RefUnwindSafe for AssertAsync<T> where
T: RefUnwindSafe, impl<T> Send for AssertAsync<T> where
T: Send, impl<T> Sync for AssertAsync<T> where
T: Sync, impl<T> UnwindSafe for AssertAsync<T> where
T: UnwindSafe, Blanket Implementations
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized, Reads some bytes from the byte stream. Read more
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self>ⓘNotable traits for ReadVectoredFuture<'_, R>
impl<'_, R> Future for ReadVectoredFuture<'_, R> where
R: AsyncRead + Unpin + ?Sized, type Output = Result<usize, Error>; where
Self: Unpin,
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self>ⓘNotable traits for ReadVectoredFuture<'_, R>
impl<'_, R> Future for ReadVectoredFuture<'_, R> where
R: AsyncRead + Unpin + ?Sized, type Output = Result<usize, Error>; where
Self: Unpin, fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self>ⓘNotable traits for ReadToEndFuture<'_, R>
impl<'_, R> Future for ReadToEndFuture<'_, R> where
R: AsyncRead + Unpin + ?Sized, type Output = Result<usize, Error>; where
Self: Unpin,
fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self>ⓘNotable traits for ReadToEndFuture<'_, R>
impl<'_, R> Future for ReadToEndFuture<'_, R> where
R: AsyncRead + Unpin + ?Sized, type Output = Result<usize, Error>; where
Self: Unpin, fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self>ⓘNotable traits for ReadToStringFuture<'_, R>
impl<'_, R> Future for ReadToStringFuture<'_, R> where
R: AsyncRead + Unpin + ?Sized, type Output = Result<usize, Error>; where
Self: Unpin,
fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self>ⓘNotable traits for ReadToStringFuture<'_, R>
impl<'_, R> Future for ReadToStringFuture<'_, R> where
R: AsyncRead + Unpin + ?Sized, type Output = Result<usize, Error>; where
Self: Unpin, fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self>ⓘNotable traits for ReadExactFuture<'_, R>
impl<'_, R> Future for ReadExactFuture<'_, R> where
R: AsyncRead + Unpin + ?Sized, type Output = Result<(), Error>; where
Self: Unpin,
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self>ⓘNotable traits for ReadExactFuture<'_, R>
impl<'_, R> Future for ReadExactFuture<'_, R> where
R: AsyncRead + Unpin + ?Sized, type Output = Result<(), Error>; where
Self: Unpin, Reads the exact number of bytes required to fill buf. Read more
Creates an adapter which will read at most limit bytes from it. Read more
Creates an adapter which will chain this stream with another. Read more
Boxes the reader and changes its type to dyn AsyncRead + Send + 'a. Read more
impl<S> AsyncSeekExt for S where
S: AsyncSeek + ?Sized,
impl<S> AsyncSeekExt for S where
S: AsyncSeek + ?Sized, fn seek(&mut self, pos: SeekFrom) -> SeekFuture<'_, Self>ⓘNotable traits for SeekFuture<'_, S>
impl<'_, S> Future for SeekFuture<'_, S> where
S: AsyncSeek + Unpin + ?Sized, type Output = Result<u64, Error>; where
Self: Unpin,
fn seek(&mut self, pos: SeekFrom) -> SeekFuture<'_, Self>ⓘNotable traits for SeekFuture<'_, S>
impl<'_, S> Future for SeekFuture<'_, S> where
S: AsyncSeek + Unpin + ?Sized, type Output = Result<u64, Error>; where
Self: Unpin, Seeks to a new position in a byte stream. Read more
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized, fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self>ⓘNotable traits for WriteFuture<'_, W>
impl<'_, W> Future for WriteFuture<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<usize, Error>; where
Self: Unpin,
fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self>ⓘNotable traits for WriteFuture<'_, W>
impl<'_, W> Future for WriteFuture<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<usize, Error>; where
Self: Unpin, Writes some bytes into the byte stream. Read more
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self>ⓘNotable traits for WriteVectoredFuture<'_, W>
impl<'_, W> Future for WriteVectoredFuture<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<usize, Error>; where
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self>ⓘNotable traits for WriteVectoredFuture<'_, W>
impl<'_, W> Future for WriteVectoredFuture<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<usize, Error>; where
Self: Unpin, fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self>ⓘNotable traits for WriteAllFuture<'_, W>
impl<'_, W> Future for WriteAllFuture<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>; where
Self: Unpin,
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self>ⓘNotable traits for WriteAllFuture<'_, W>
impl<'_, W> Future for WriteAllFuture<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>; where
Self: Unpin, Writes an entire buffer into the byte stream. Read more
fn flush(&mut self) -> FlushFuture<'_, Self>ⓘNotable traits for FlushFuture<'_, W>
impl<'_, W> Future for FlushFuture<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>; where
Self: Unpin,
fn flush(&mut self) -> FlushFuture<'_, Self>ⓘNotable traits for FlushFuture<'_, W>
impl<'_, W> Future for FlushFuture<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>; where
Self: Unpin, Flushes the stream to ensure that all buffered contents reach their destination. Read more
fn close(&mut self) -> CloseFuture<'_, Self>ⓘNotable traits for CloseFuture<'_, W>
impl<'_, W> Future for CloseFuture<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>; where
Self: Unpin,
fn close(&mut self) -> CloseFuture<'_, Self>ⓘNotable traits for CloseFuture<'_, W>
impl<'_, W> Future for CloseFuture<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>; where
Self: Unpin, Closes the writer. Read more
Boxes the writer and changes its type to dyn AsyncWrite + Send + 'a. Read more
Mutably borrows from an owned value. Read more
type Output = T
type Output = TShould always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> boolChecks if self is actually part of its subset T (and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SSUse with care! Same as self.to_subset but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SPThe inclusion map: converts self to the equivalent element of its superset.
pub fn vzip(self) -> V