pub struct Connection<R, W> { /* private fields */ }Expand description
A client’s side of one protocol connection: a buffered reader, a writer, and the decoder that bounds what the server may send.
Implementations§
Source§impl<R, W> Connection<R, W>
impl<R, W> Connection<R, W>
Sourcepub fn new(reader: R, writer: W, decoder: FrameDecoder) -> Self
pub fn new(reader: R, writer: W, decoder: FrameDecoder) -> Self
Wrap a stream’s halves; decoder sets the frame limit.
Sourcepub async fn send(&mut self, message: &ClientMessage) -> Result<()>
pub async fn send(&mut self, message: &ClientMessage) -> Result<()>
Send one message.
Sourcepub async fn read(&mut self) -> Result<Frame>
pub async fn read(&mut self) -> Result<Frame>
The next frame. Cancel-safe, like read_frame.
Trait Implementations§
Auto Trait Implementations§
impl<R, W> Freeze for Connection<R, W>
impl<R, W> RefUnwindSafe for Connection<R, W>where
R: RefUnwindSafe,
W: RefUnwindSafe,
impl<R, W> Send for Connection<R, W>
impl<R, W> Sync for Connection<R, W>
impl<R, W> Unpin for Connection<R, W>
impl<R, W> UnsafeUnpin for Connection<R, W>where
R: UnsafeUnpin,
W: UnsafeUnpin,
impl<R, W> UnwindSafe for Connection<R, W>where
R: UnwindSafe,
W: UnwindSafe,
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