Trait leptos::Serializable
source · pub trait Serializable: Sized {
// Required methods
fn ser(&self) -> Result<String, SerializationError>;
fn de(bytes: &str) -> Result<Self, SerializationError>;
}
Expand description
Describes an object that can be serialized to or from a supported format Currently those are JSON and Cbor
This is primarily used for serializing and deserializing Resource
s
so they can begin on the server and be resolved on the client, but can be used
for any data that needs to be serialized/deserialized.
This trait is intended to abstract over various serialization crates,
as selected between by the crate features serde
(default), serde-lite
,
and miniserde
.
Required Methods§
sourcefn ser(&self) -> Result<String, SerializationError>
fn ser(&self) -> Result<String, SerializationError>
Serializes the object to a string.
sourcefn de(bytes: &str) -> Result<Self, SerializationError>
fn de(bytes: &str) -> Result<Self, SerializationError>
Deserializes the object from some bytes.
Object Safety§
This trait is not object safe.