Struct Frame
pub struct Frame { /* private fields */ }Expand description
A struct representing a WebSocket frame.
Implementations§
§impl Frame
impl Frame
pub fn len(&self) -> usize
pub fn len(&self) -> usize
Get the length of the frame. This is the length of the header + the length of the payload.
pub fn header(&self) -> &FrameHeader
pub fn header(&self) -> &FrameHeader
Get a reference to the frame’s header.
pub fn header_mut(&mut self) -> &mut FrameHeader
pub fn header_mut(&mut self) -> &mut FrameHeader
Get a mutable reference to the frame’s header.
pub fn into_payload(self) -> Bytes
pub fn into_payload(self) -> Bytes
Consume the frame into its payload.
pub fn message(data: impl Into<Bytes>, opcode: OpCode, is_final: bool) -> Frame
pub fn message(data: impl Into<Bytes>, opcode: OpCode, is_final: bool) -> Frame
Create a new data frame.
pub fn close(msg: Option<CloseFrame>) -> Frame
pub fn close(msg: Option<CloseFrame>) -> Frame
Create a new Close control frame.
pub fn from_payload(header: FrameHeader, payload: Bytes) -> Frame
pub fn from_payload(header: FrameHeader, payload: Bytes) -> Frame
Create a frame from given header and data.
Trait Implementations§
impl Eq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations§
impl !Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.