[−][src]Struct twitchchat::AsyncEncoder
This is supported on crate feature
async
only.An asynchronous encoder.
Implementations
impl<W> AsyncEncoder<W> where
W: Write + Send + Sync,
[src]
W: Write + Send + Sync,
pub fn encode_sync<M>(&mut self, msg: M) -> IoResult<()> where
M: Encodable + Send + Sync,
[src]
M: Encodable + Send + Sync,
If the wrapped writer is synchronous, you can use this method to encode the message to it.
impl<W> AsyncEncoder<W> where
W: AsyncWrite + Send + Sync + Unpin,
[src]
W: AsyncWrite + Send + Sync + Unpin,
pub fn new(writer: W) -> Self
[src]
Create a new Encoder over this futures_lite::AsyncWrite instance
pub async fn into_inner(__arg0: Self) -> IoResult<W>
[src]
Get the inner futures_lite::AsyncWrite instance out
This writes and flushes any buffered data before it consumes self.
pub async fn encode<M, '_>(&'_ mut self, msg: M) -> IoResult<()> where
M: Encodable + Send + Sync,
W: Unpin,
[src]
M: Encodable + Send + Sync,
W: Unpin,
Encode this Encodable message to the writer.
This flushes the data before returning
Trait Implementations
impl<W> AsyncWrite for AsyncEncoder<W> where
W: AsyncWrite + Unpin + Send + Sync,
[src]
W: AsyncWrite + Unpin + Send + Sync,
fn poll_write(
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &[u8]
) -> Poll<IoResult<usize>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &[u8]
) -> Poll<IoResult<usize>>
fn poll_flush(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll<IoResult<()>>
[src]
fn poll_close(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll<IoResult<()>>
[src]
fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>]
) -> Poll<Result<usize, Error>>
[src]
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>]
) -> Poll<Result<usize, Error>>
impl<W> Clone for AsyncEncoder<W> where
W: Clone,
[src]
W: Clone,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<W> Debug for AsyncEncoder<W>
[src]
impl<W> Write for AsyncEncoder<W> where
W: Write + Send + Sync,
[src]
W: Write + Send + Sync,
fn write(&mut self, buf: &[u8]) -> IoResult<usize>
[src]
fn flush(&mut self) -> IoResult<()>
[src]
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>
1.36.0[src]
fn is_write_vectored(&self) -> bool
[src]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
[src]
fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Auto Trait Implementations
impl<W> RefUnwindSafe for AsyncEncoder<W> where
W: RefUnwindSafe,
W: RefUnwindSafe,
impl<W> Send for AsyncEncoder<W> where
W: Send,
W: Send,
impl<W> Sync for AsyncEncoder<W> where
W: Sync,
W: Sync,
impl<W> Unpin for AsyncEncoder<W> where
W: Unpin,
W: Unpin,
impl<W> UnwindSafe for AsyncEncoder<W> where
W: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
W: AsyncWrite + ?Sized,
fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self> where
Self: Unpin,
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
Self: Unpin,
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
Self: Unpin,
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self> where
Self: Unpin,
Self: Unpin,
fn flush(&mut self) -> FlushFuture<'_, Self> where
Self: Unpin,
Self: Unpin,
fn close(&mut self) -> CloseFuture<'_, Self> where
Self: Unpin,
Self: Unpin,
fn boxed_writer<'a>(self) -> Pin<Box<dyn AsyncWrite + 'a + Send>> where
Self: Send + 'a,
Self: Send + 'a,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> FuturesAsyncWriteCompatExt for T where
T: AsyncWrite,
[src]
T: AsyncWrite,
fn compat_write(self) -> Compat<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WriteExt for T where
T: AsyncWrite + ?Sized,
T: AsyncWrite + ?Sized,
fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self> where
Self: Unpin,
Self: Unpin,
fn flush(&mut self) -> FlushFuture<'_, Self> where
Self: Unpin,
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
Self: Unpin,
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
Self: Unpin,
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self> where
Self: Unpin,
Self: Unpin,
fn write_fmt(&'a mut self, fmt: Arguments<'_>) -> WriteFmtFuture<'a, Self> where
Self: Unpin,
Self: Unpin,