pub trait Serializer: Sized + 'static {
type Target: Sized + 'static;
// Required methods
fn write_data(
value: &Self::Target,
context: &mut WriteContext<'_>,
) -> Result<(), Error>;
fn read_data(context: &mut ReadContext<'_>) -> Result<Self::Target, Error>;
// Provided methods
fn default_value(
context: &mut ReadContext<'_>,
) -> Result<Self::Target, Error> { ... }
fn read_arc_any(
context: &mut ReadContext<'_>,
) -> Result<Arc<dyn Any + Send + Sync>, Error> { ... }
}Expand description
Static serialization behavior for one runtime Serializer::Target.
Implementations define type-level serialization behavior and are never
instantiated by Fory. Ordinary local types use Target = Self.
Required Associated Types§
Required Methods§
Sourcefn write_data(
value: &Self::Target,
context: &mut WriteContext<'_>,
) -> Result<(), Error>
fn write_data( value: &Self::Target, context: &mut WriteContext<'_>, ) -> Result<(), Error>
Write the target body only.
Provided Methods§
Sourcefn default_value(context: &mut ReadContext<'_>) -> Result<Self::Target, Error>
fn default_value(context: &mut ReadContext<'_>) -> Result<Self::Target, Error>
Construct a target for a null or missing local value.
Sourcefn read_arc_any(
context: &mut ReadContext<'_>,
) -> Result<Arc<dyn Any + Send + Sync>, Error>
fn read_arc_any( context: &mut ReadContext<'_>, ) -> Result<Arc<dyn Any + Send + Sync>, Error>
Read directly into the final owner for sync dynamic carriers.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".