Struct Smol

Source
pub struct Smol<T>(pub T);
Available on crate feature smol only.
Expand description

Wrapper IO type for smol::io::AsyncRead and smol::io::AsyncWrite.

Tuple Fields§

§0: T

Trait Implementations§

Source§

impl<T> AsyncRead for Smol<T>
where T: AsyncRead,

Source§

type Error = Error

Error type for IO operations involving the reader.
Source§

fn poll_read_slice( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<Result<usize, Self::Error>>

Poll the reader once and read some bytes into the slice buf. Read more
Source§

impl<T> AsyncWrite for Smol<T>
where T: AsyncWrite,

Source§

type Error = Error

Error type for IO operations involving the writer.
Source§

fn poll_write_slice( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize, Self::Error>>

Poll the writer and try to write some bytes from buf to it. Read more
Source§

fn poll_flush_once( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Poll the writer and try to flush it only once.
Source§

impl<T> Container for Smol<T>

Source§

type Inner = T

The inner type this container stores.
Source§

fn from_inner(inner: Self::Inner) -> Self

Construct a Self from the inner type.
Source§

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

Get a reference to the inner type.
Source§

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

Get a mutable reference to the inner type.
Source§

fn into_inner(self) -> Self::Inner

Destruct the container into its inner type.
Source§

impl<T: Debug> Debug for Smol<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T> IntoRead<Smol<T>> for T
where T: AsyncRead,

Source§

fn into_read(self) -> Smol<T>

Convert self to a reader T.
Source§

impl<T> IntoWrite<Smol<T>> for T
where T: AsyncWrite,

Source§

fn into_write(self) -> Smol<T>

Convert self to a writer T.
Source§

impl<'pin, T> Unpin for Smol<T>
where PinnedFieldsOf<__Smol<'pin, T>>: Unpin,

Auto Trait Implementations§

§

impl<T> Freeze for Smol<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Smol<T>
where T: RefUnwindSafe,

§

impl<T> Send for Smol<T>
where T: Send,

§

impl<T> Sync for Smol<T>
where T: Sync,

§

impl<T> UnwindSafe for Smol<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsyncReadExt for T
where T: AsyncRead + ?Sized,

Source§

fn poll_read_buf<B>( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut B, ) -> Poll<Result<(), Self::Error>>
where B: BufMut + ?Sized,

Poll the reader and try to read some bytes into buf.
Source§

fn poll_read_buf_all<B>( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut B, ) -> Poll<Result<(), Self::Error>>
where B: BufMut + ?Sized,

Poll the reader and try to read some bytes into buf.
Source§

fn read_buf<B>(&mut self, buf: B) -> ReadBuf<'_, Self, B>
where B: BufMut + Unpin, Self: Unpin,

Asynchronously read some bytes into buf advancing it appropriately. Read more
Source§

fn read_buf_all<B>(&mut self, buf: B) -> ReadBufAll<'_, Self, B>
where B: BufMut + Unpin, Self: Unpin,

Asynchronously read bytes into buf advancing it until it is full. Read more
Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Create a “by reference” adapter that takes the current instance of AsyncRead by mutable reference.
Source§

impl<T> AsyncWriteExt for T
where T: AsyncWrite + ?Sized,

Source§

fn poll_write_buf<B>( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut B, ) -> Poll<Result<(), Self::Error>>
where B: Buf + ?Sized,

Poll the writer and try to write buf to it.
Source§

fn poll_write_buf_all<B>( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut B, ) -> Poll<Result<(), Self::Error>>
where B: Buf + ?Sized,

Poll the writer and try to write buf to it.
Source§

fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Poll the writer and try to flush it.
Source§

fn write_buf<B>(&mut self, buf: B) -> WriteBuf<'_, Self, B>
where B: Buf + Unpin, Self: Unpin,

Asynchronously write buf to the writer advancing it appropriately Read more
Source§

fn write_buf_all<B>(&mut self, buf: B) -> WriteBufAll<'_, Self, B>
where B: Buf + Unpin, Self: Unpin,

Asynchronously write buf to the writer advancing it until all of it has been written. Read more
Source§

fn flush(&mut self) -> Flush<'_, Self>
where Self: Unpin,

Asynchronously flush the writer. Read more
Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Create a “by reference” adapter that takes the current instance of AsyncWrite by mutable reference.
Source§

fn transaction( self, kind: WriteTransactionKind<'_>, ) -> WriteTransactionVariant<'_, Self>
where Self: Sized,

Available on crate feature alloc only.
Create a transaction that uses this instance of AsyncWrite. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoRead<NativeAsync<T>> for T
where T: AsyncRead,

Source§

fn into_read(self) -> NativeAsync<T>

Convert self to a reader T.
Source§

impl<T> IntoWrite<NativeAsync<T>> for T
where T: AsyncWrite,

Source§

fn into_write(self) -> NativeAsync<T>

Convert self to a writer T.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.