pub struct OwnedFrame { /* private fields */ }
Expand description
owned frame
Implementations§
Source§impl OwnedFrame
impl OwnedFrame
Sourcepub fn new(code: OpCode, mask: impl Into<Option<[u8; 4]>>, data: &[u8]) -> Self
pub fn new(code: OpCode, mask: impl Into<Option<[u8; 4]>>, data: &[u8]) -> Self
construct new owned frame
Sourcepub fn with_raw(header: Header, payload: BytesMut) -> Self
pub fn with_raw(header: Header, payload: BytesMut) -> Self
use constructed header and payload
NOTE: this will not check header and payload
Sourcepub fn text_frame(mask: impl Into<Option<[u8; 4]>>, data: &str) -> Self
pub fn text_frame(mask: impl Into<Option<[u8; 4]>>, data: &str) -> Self
helper function to construct a text frame
Sourcepub fn binary_frame(mask: impl Into<Option<[u8; 4]>>, data: &[u8]) -> Self
pub fn binary_frame(mask: impl Into<Option<[u8; 4]>>, data: &[u8]) -> Self
helper function to construct a binary frame
Sourcepub fn ping_frame(mask: impl Into<Option<[u8; 4]>>, data: &[u8]) -> Self
pub fn ping_frame(mask: impl Into<Option<[u8; 4]>>, data: &[u8]) -> Self
helper function to construct a ping frame
Sourcepub fn pong_frame(mask: impl Into<Option<[u8; 4]>>, data: &[u8]) -> Self
pub fn pong_frame(mask: impl Into<Option<[u8; 4]>>, data: &[u8]) -> Self
helper function to construct a pong frame
Sourcepub fn close_frame(
mask: impl Into<Option<[u8; 4]>>,
code: impl Into<Option<u16>>,
data: &[u8],
) -> Self
pub fn close_frame( mask: impl Into<Option<[u8; 4]>>, code: impl Into<Option<u16>>, data: &[u8], ) -> Self
helper function to construct a close frame
Sourcepub fn mask(&mut self, mask: [u8; 4])
pub fn mask(&mut self, mask: [u8; 4])
mask frame with provide mask key
this will override old mask
Sourcepub fn extend_from_slice(&mut self, data: &[u8])
pub fn extend_from_slice(&mut self, data: &[u8])
extend frame payload
NOTE this function will unmask first, and then extend payload, mask with old mask key finally
Sourcepub fn header_mut(&mut self) -> &mut Header
pub fn header_mut(&mut self) -> &mut Header
get mutable frame header
Trait Implementations§
Source§impl Clone for OwnedFrame
impl Clone for OwnedFrame
Source§fn clone(&self) -> OwnedFrame
fn clone(&self) -> OwnedFrame
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for OwnedFrame
impl RefUnwindSafe for OwnedFrame
impl Send for OwnedFrame
impl Sync for OwnedFrame
impl Unpin for OwnedFrame
impl UnwindSafe for OwnedFrame
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