pub struct Codec { /* private fields */ }
Expand description
Codec for encoding/decoding websocket base frames.
Implementations
sourceimpl Codec
impl Codec
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new base frame codec.
The codec will support decoding payload lengths up to 256 MiB
(use set_max_data_size
to change this value).
sourcepub fn max_data_size(&self) -> usize
pub fn max_data_size(&self) -> usize
Get the configured maximum payload length.
sourcepub fn set_max_data_size(&mut self, size: usize) -> &mut Self
pub fn set_max_data_size(&mut self, size: usize) -> &mut Self
Limit the maximum size of payload data to size
bytes.
sourcepub fn add_reserved_bits(&mut self, bits: (bool, bool, bool)) -> &mut Self
pub fn add_reserved_bits(&mut self, bits: (bool, bool, bool)) -> &mut Self
Add to the reserved bits in use.
sourcepub fn clear_reserved_bits(&mut self)
pub fn clear_reserved_bits(&mut self)
Reset the reserved bits.
sourcepub fn decode_header(
&self,
bytes: &[u8]
) -> Result<Parsing<Header, usize>, Error>
pub fn decode_header(
&self,
bytes: &[u8]
) -> Result<Parsing<Header, usize>, Error>
Decode a websocket frame header.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Codec
impl Send for Codec
impl Sync for Codec
impl Unpin for Codec
impl UnwindSafe for Codec
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more