pub struct FrameSocket<Stream> { /* private fields */ }
Expand description
A reader and writer for WebSocket frames.
Implementations§
Source§impl<Stream> FrameSocket<Stream>
impl<Stream> FrameSocket<Stream>
Sourcepub fn from_partially_read(stream: Stream, part: Vec<u8>) -> Self
pub fn from_partially_read(stream: Stream, part: Vec<u8>) -> Self
Create a new frame socket from partially read data.
Sourcepub fn into_inner(self) -> (Stream, Vec<u8>)
pub fn into_inner(self) -> (Stream, Vec<u8>)
Extract a stream from the socket.
Sourcepub fn get_mut(&mut self) -> &mut Stream
pub fn get_mut(&mut self) -> &mut Stream
Returns a mutable reference to the inner stream.
Source§impl<Stream> FrameSocket<Stream>where
Stream: Read,
impl<Stream> FrameSocket<Stream>where
Stream: Read,
Source§impl<Stream> FrameSocket<Stream>where
Stream: Write,
impl<Stream> FrameSocket<Stream>where
Stream: Write,
Sourcepub fn write(&mut self, frame: Frame) -> Result<()>
pub fn write(&mut self, frame: Frame) -> Result<()>
Write a frame to stream.
A subsequent call should be made to flush
to flush writes.
This function guarantees that the frame is queued unless Error::WriteBufferFull
is returned.
In order to handle WouldBlock or Incomplete, call flush
afterwards.
Trait Implementations§
Auto Trait Implementations§
impl<Stream> Freeze for FrameSocket<Stream>where
Stream: Freeze,
impl<Stream> RefUnwindSafe for FrameSocket<Stream>where
Stream: RefUnwindSafe,
impl<Stream> Send for FrameSocket<Stream>where
Stream: Send,
impl<Stream> Sync for FrameSocket<Stream>where
Stream: Sync,
impl<Stream> Unpin for FrameSocket<Stream>where
Stream: Unpin,
impl<Stream> UnwindSafe for FrameSocket<Stream>where
Stream: 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