Struct tungstenite::protocol::frame::FrameSocket
source · 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