pub struct CommonParser;
Expand description
Parse and serialize from and into the socket.io common packet format. See details in the socket.io protocol doc.
Trait Implementations§
Source§impl Clone for CommonParser
impl Clone for CommonParser
Source§fn clone(&self) -> CommonParser
fn clone(&self) -> CommonParser
Returns a duplicate 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 moreSource§impl Debug for CommonParser
impl Debug for CommonParser
Source§impl Default for CommonParser
impl Default for CommonParser
Source§fn default() -> CommonParser
fn default() -> CommonParser
Returns the “default value” for a type. Read more
Source§impl Parse for CommonParser
impl Parse for CommonParser
Source§fn decode_str(
self,
state: &ParserState,
value: Str,
) -> Result<Packet, ParseError>
fn decode_str( self, state: &ParserState, value: Str, ) -> Result<Packet, ParseError>
Parse a given input string. If the payload needs more adjacent binary packet,
the partial packet will be kept and a
ParseError::NeedsMoreBinaryData
will be returned.Source§fn decode_bin(
self,
state: &ParserState,
data: Bytes,
) -> Result<Packet, ParseError>
fn decode_bin( self, state: &ParserState, data: Bytes, ) -> Result<Packet, ParseError>
Parse a given input binary. If the payload needs more adjacent binary packet,
the partial packet is still kept and a
ParseError::NeedsMoreBinaryData
will be returned.Source§fn encode_value<T: ?Sized + Serialize>(
self,
data: &T,
event: Option<&str>,
) -> Result<Value, ParserError>
fn encode_value<T: ?Sized + Serialize>( self, data: &T, event: Option<&str>, ) -> Result<Value, ParserError>
Source§fn decode_value<'de, T: Deserialize<'de>>(
self,
value: &'de mut Value,
with_event: bool,
) -> Result<T, ParserError>
fn decode_value<'de, T: Deserialize<'de>>( self, value: &'de mut Value, with_event: bool, ) -> Result<T, ParserError>
Source§fn decode_default<'de, T: Deserialize<'de>>(
self,
value: Option<&'de Value>,
) -> Result<T, ParserError>
fn decode_default<'de, T: Deserialize<'de>>( self, value: Option<&'de Value>, ) -> Result<T, ParserError>
Convert any generic
Value
to a type with the default serde impl without binary + event tricks.
This is mainly used for connect payloads.Source§fn encode_default<T: ?Sized + Serialize>(
self,
data: &T,
) -> Result<Value, ParserError>
fn encode_default<T: ?Sized + Serialize>( self, data: &T, ) -> Result<Value, ParserError>
Convert any type to a generic
Value
with the default serde impl without binary + event tricks.
This is mainly used for connect payloads.Source§fn read_event(self, value: &Value) -> Result<&str, ParserError>
fn read_event(self, value: &Value) -> Result<&str, ParserError>
Try to read the event name from the given payload data.
The event name should be the first element of the provided array according to the serde model.
impl Copy for CommonParser
Auto Trait Implementations§
impl Freeze for CommonParser
impl RefUnwindSafe for CommonParser
impl Send for CommonParser
impl Sync for CommonParser
impl Unpin for CommonParser
impl UnwindSafe for CommonParser
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