Struct FrameSocket

struct FrameSocket<Stream> { ... }

A reader and writer for WebSocket frames.

Implementations

impl<Stream> FrameSocket<Stream>

fn send(self: &mut Self, frame: Frame) -> Result<()>

Writes and immediately flushes a frame. Equivalent to calling write then flush.

fn write(self: &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.

fn flush(self: &mut Self) -> Result<()>

Flush writes.

impl<Stream> FrameSocket<Stream>

fn read(self: &mut Self, max_size: Option<usize>) -> Result<Option<Frame>>

Read a frame from stream.

impl<Stream> FrameSocket<Stream>

fn new(stream: Stream) -> Self

Create a new frame socket.

fn from_partially_read(stream: Stream, part: Vec<u8>) -> Self

Create a new frame socket from partially read data.

fn into_inner(self: Self) -> (Stream, BytesMut)

Extract a stream from the socket.

fn get_ref(self: &Self) -> &Stream

Returns a shared reference to the inner stream.

fn get_mut(self: &mut Self) -> &mut Stream

Returns a mutable reference to the inner stream.

impl<Stream> Freeze for FrameSocket<Stream>

impl<Stream> RefUnwindSafe for FrameSocket<Stream>

impl<Stream> Send for FrameSocket<Stream>

impl<Stream> Sync for FrameSocket<Stream>

impl<Stream> Unpin for FrameSocket<Stream>

impl<Stream> UnsafeUnpin for FrameSocket<Stream>

impl<Stream> UnwindSafe for FrameSocket<Stream>

impl<Stream: $crate::fmt::Debug> Debug for FrameSocket<Stream>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T> Any for FrameSocket<Stream>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for FrameSocket<Stream>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for FrameSocket<Stream>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for FrameSocket<Stream>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Same for FrameSocket<Stream>

impl<T, U> Into for FrameSocket<Stream>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for FrameSocket<Stream>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for FrameSocket<Stream>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<V, T> VZip for FrameSocket<Stream>

fn vzip(self: Self) -> V