Struct Frame
struct Frame { ... }
A struct representing a WebSocket frame.
Implementations
impl Frame
fn len(self: &Self) -> usizeGet the length of the frame. This is the length of the header + the length of the payload.
fn is_empty(self: &Self) -> boolCheck if the frame is empty.
fn header(self: &Self) -> &FrameHeaderGet a reference to the frame's header.
fn header_mut(self: &mut Self) -> &mut FrameHeaderGet a mutable reference to the frame's header.
fn payload(self: &Self) -> &[u8]Get a reference to the frame's payload.
fn into_text(self: Self) -> StdResult<Utf8Bytes, Utf8Error>Consume the frame into its payload as string.
fn into_payload(self: Self) -> BytesConsume the frame into its payload.
fn to_text(self: &Self) -> Result<&str, Utf8Error>Get frame payload as
&str.fn message<impl Into<Bytes>: Into<Bytes>>(data: impl Into<Bytes>, opcode: OpCode, is_final: bool) -> FrameCreate a new data frame.
fn pong<impl Into<Bytes>: Into<Bytes>>(data: impl Into<Bytes>) -> FrameCreate a new Pong control frame.
fn ping<impl Into<Bytes>: Into<Bytes>>(data: impl Into<Bytes>) -> FrameCreate a new Ping control frame.
fn close(msg: Option<CloseFrame>) -> FrameCreate a new Close control frame.
fn from_payload(header: FrameHeader, payload: Bytes) -> SelfCreate a frame from given header and data.
fn format<impl Write: Write>(self: Self, output: &mut impl Write) -> Result<()>Write a frame out to a buffer
impl Clone for Frame
fn clone(self: &Self) -> Frame
impl Debug for Frame
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Display for Frame
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Eq for Frame
impl Freeze for Frame
impl PartialEq for Frame
fn eq(self: &Self, other: &Frame) -> bool
impl RefUnwindSafe for Frame
impl Send for Frame
impl StructuralPartialEq for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
impl<T> Any for Frame
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Frame
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Frame
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Frame
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Frame
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Same for Frame
impl<T> ToOwned for Frame
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for Frame
fn to_string(self: &Self) -> String
impl<T, U> Into for Frame
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Frame
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Frame
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<V, T> VZip for Frame
fn vzip(self: Self) -> V