pub enum SerializerType {
Json,
}Expand description
Serializer type enum for dynamic dispatch without dyn trait issues
Variants§
Json
JSON serializer
Implementations§
Source§impl SerializerType
impl SerializerType
Sourcepub fn from_content_type(content_type: &str) -> SerializerResult<Self>
pub fn from_content_type(content_type: &str) -> SerializerResult<Self>
Get a serializer type by content type string
Sourcepub fn serialize<T: Serialize>(&self, value: &T) -> SerializerResult<Vec<u8>>
pub fn serialize<T: Serialize>(&self, value: &T) -> SerializerResult<Vec<u8>>
Serialize a value to bytes
Sourcepub fn deserialize<T: DeserializeOwned>(
&self,
bytes: &[u8],
) -> SerializerResult<T>
pub fn deserialize<T: DeserializeOwned>( &self, bytes: &[u8], ) -> SerializerResult<T>
Deserialize bytes to a value
Sourcepub fn content_type(&self) -> ContentType
pub fn content_type(&self) -> ContentType
Get the content type
Sourcepub fn content_encoding(&self) -> ContentEncoding
pub fn content_encoding(&self) -> ContentEncoding
Get the content encoding
Trait Implementations§
Source§impl Clone for SerializerType
impl Clone for SerializerType
Source§fn clone(&self) -> SerializerType
fn clone(&self) -> SerializerType
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 SerializerType
impl Debug for SerializerType
Source§impl Default for SerializerType
impl Default for SerializerType
Source§fn default() -> SerializerType
fn default() -> SerializerType
Returns the “default value” for a type. Read more
Source§impl Display for SerializerType
impl Display for SerializerType
Source§impl Hash for SerializerType
impl Hash for SerializerType
Source§impl PartialEq for SerializerType
impl PartialEq for SerializerType
Source§impl TryFrom<&str> for SerializerType
impl TryFrom<&str> for SerializerType
impl Copy for SerializerType
impl Eq for SerializerType
impl StructuralPartialEq for SerializerType
Auto Trait Implementations§
impl Freeze for SerializerType
impl RefUnwindSafe for SerializerType
impl Send for SerializerType
impl Sync for SerializerType
impl Unpin for SerializerType
impl UnwindSafe for SerializerType
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