pub trait Serialize {
// Required method
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer;
}Expand description
A data structure that can be serialized into any data format supported by the SpacetimeDB Algebraic Type System.
In most cases, implementations of Serialize may be #[derive(Serialize)]d.
The Serialize trait in SATS performs the same function as serde::Serialize in serde.
See the documentation of serde::Serialize for more information of the data model.
Do not manually implement this trait unless you know what you are doing.
Implementations must be consistent with Deerialize<'de> for T, SpacetimeType for T and Serialize, Deserialize for AlgebraicValue.
Implementations that are inconsistent across these traits may result in data loss.
Required Methods§
Sourcefn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize self in the data format of S using the provided serializer.
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.