pub trait Serializable: Serialize + for<'de> Deserialize<'de> {
// Provided methods
fn from_json_bytes(data: &[u8]) -> Result<Self, Error> { ... }
fn from_msgpack_bytes(data: &[u8]) -> Result<Self, Error> { ... }
fn as_json_bytes(&self) -> Result<Bytes, Error> { ... }
fn as_msgpack_bytes(&self) -> Result<Bytes, Error> { ... }
}
Expand description
Represents types which are serializable for JSON and MsgPack
specifications.
Provided Methods§
Sourcefn from_json_bytes(data: &[u8]) -> Result<Self, Error>
fn from_json_bytes(data: &[u8]) -> Result<Self, Error>
Sourcefn from_msgpack_bytes(data: &[u8]) -> Result<Self, Error>
fn from_msgpack_bytes(data: &[u8]) -> Result<Self, Error>
Sourcefn as_json_bytes(&self) -> Result<Bytes, Error>
fn as_json_bytes(&self) -> Result<Bytes, Error>
Sourcefn as_msgpack_bytes(&self) -> Result<Bytes, Error>
fn as_msgpack_bytes(&self) -> Result<Bytes, Error>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.