pub trait CustomSerializer<T> {
    // Provided methods
    fn to_json_string(&self) -> String
       where Self: Serialize + Sized { ... }
    fn from_json_string(data_string: String) -> T
       where T: for<'a> Deserialize<'a> { ... }
}
Expand description

A trait for custom serialization and deserialization.

Provides methods to convert the implementing type to and from JSON strings.

Provided Methods§

source

fn to_json_string(&self) -> String
where Self: Serialize + Sized,

Serializes the implementor into a JSON string.

§Errors

Returns an error if serialization fails.

source

fn from_json_string(data_string: String) -> T
where T: for<'a> Deserialize<'a>,

Deserializes an instance of the implementing type from a JSON string.

§Arguments
  • data_string - A string slice containing the JSON representation.
§Errors

Returns an error if deserialization fails.

Object Safety§

This trait is not object safe.

Implementors§