pub struct SocketRx<R: Read> { /* private fields */ }Available on crate feature
ws only.Expand description
A source of Web Socket Frames.
Implementations§
Source§impl<R: Read> SocketRx<R>
impl<R: Read> SocketRx<R>
Sourcepub async fn next_frame<Signal: Future>(
&mut self,
buffer: &mut [u8],
signal: Signal,
) -> Result<Either<Result<Frame, ReadFrameError>, Signal::Output>, R::Error>
pub async fn next_frame<Signal: Future>( &mut self, buffer: &mut [u8], signal: Signal, ) -> Result<Either<Result<Frame, ReadFrameError>, Signal::Output>, R::Error>
Read the next frame unless signal resolves before receiving the start of the frame. signal must be cancel-safe.
If the frame is not final, then before calling next_message,
next_frame must be repeatedly called until a final frame is received.
next_frame is not cancel-safe.
Sourcepub async fn next_message<'a, Signal: Future>(
&mut self,
buffer: &'a mut [u8],
signal: Signal,
) -> Result<Either<Result<Message<'a>, ReadMessageError>, Signal::Output>, R::Error>
pub async fn next_message<'a, Signal: Future>( &mut self, buffer: &'a mut [u8], signal: Signal, ) -> Result<Either<Result<Message<'a>, ReadMessageError>, Signal::Output>, R::Error>
Read the next message unless signal resolves before receiving the start of the message. signal must be cancel-safe. Frame data is concatenated together.
Auto Trait Implementations§
impl<R> Freeze for SocketRx<R>where
R: Freeze,
impl<R> RefUnwindSafe for SocketRx<R>where
R: RefUnwindSafe,
impl<R> Send for SocketRx<R>where
R: Send,
impl<R> Sync for SocketRx<R>where
R: Sync,
impl<R> Unpin for SocketRx<R>where
R: Unpin,
impl<R> UnwindSafe for SocketRx<R>where
R: 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