pub struct Codec { /* private fields */ }Expand description
Encoder and decoder for WebSocket frames.
Implementations§
Source§impl Codec
impl Codec
Sourcepub fn max_size(self, size: usize) -> Self
pub fn max_size(self, size: usize) -> Self
Sets the maximum accepted frame payload size.
The default is 64 KiB.
Sourcepub fn set_client_mode(self) -> Self
pub fn set_client_mode(self) -> Self
Configures the codec for client-side masking rules.
Client mode masks encoded frames and rejects masked incoming frames. By default, the codec uses server-side masking rules.
Sourcepub fn encode_page(
&self,
page: BytePage,
dst: &mut BytePages,
) -> Result<(), ProtocolError>
pub fn encode_page( &self, page: BytePage, dst: &mut BytePages, ) -> Result<(), ProtocolError>
Encodes page as a final binary frame.
§Errors
Returns ProtocolError::Closed if a close message has already been
encoded, or ProtocolError::ContinuationStarted if a fragmented
message is in progress.
Trait Implementations§
Source§impl Decoder for Codec
impl Decoder for Codec
Auto Trait Implementations§
impl !Freeze for Codec
impl !RefUnwindSafe for Codec
impl !Sync for Codec
impl Send for Codec
impl Unpin for Codec
impl UnsafeUnpin for Codec
impl UnwindSafe for Codec
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