Trait leptos_reactive::Serializable
source · pub trait Serializablewhere
Self: 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 Resources 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.