pub struct Framed<U> { /* private fields */ }Expand description
A codec-driven interface to an underlying I/O stream.
Uses the Encoder and Decoder traits to encode and decode frames.
Implementations§
Source§impl<U> Framed<U>
impl<U> Framed<U>
Source§impl<U> Framed<U>where
U: Decoder,
impl<U> Framed<U>where
U: Decoder,
Sourcepub async fn recv(&self) -> Result<Option<U::Item>, Either<U::Error, Error>>
pub async fn recv(&self) -> Result<Option<U::Item>, Either<U::Error, Error>>
Reads and decodes the next item.
Returns Ok(None) when the connection can no longer produce another
complete item and no error was recorded. Codec errors are returned in
Either::Left; dispatcher timeouts and connection errors from the
transport, a filter, or shutdown are returned in Either::Right.
Source§impl<U> Framed<U>where
U: Encoder,
impl<U> Framed<U>where
U: Encoder,
Sourcepub async fn send(
&self,
item: <U as Encoder>::Item,
) -> Result<(), Either<U::Error, Error>>
pub async fn send( &self, item: <U as Encoder>::Item, ) -> Result<(), Either<U::Error, Error>>
Encodes an item and fully flushes it to the transport.
Codec errors are returned in Either::Left; connection errors from the
transport, a filter, or shutdown, including an expired write timeout,
are returned in Either::Right.
Trait Implementations§
Auto Trait Implementations§
impl<U> !Freeze for Framed<U>
impl<U> !RefUnwindSafe for Framed<U>
impl<U> !Send for Framed<U>
impl<U> !Sync for Framed<U>
impl<U> !UnwindSafe for Framed<U>
impl<U> Unpin for Framed<U>where
U: Unpin,
impl<U> UnsafeUnpin for Framed<U>where
U: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more