pub trait Serializer:
Clone
+ Send
+ Sync
+ 'static
+ Sealed {
type Format: Clone + Send + Sync + 'static;
// Required methods
fn lookup(&self, name: &str) -> Option<ContentType<Self::Format>>;
fn serialize<T>(
&self,
value: &T,
format: &Self::Format,
context: &SerializerContext<'_>,
) -> Result<Bytes, Error>
where T: Serialize;
}Expand description
Serialize an HTTP response body
Serializer values use one or more Serde serializers to perform
the actual serialization.
The Serializer values are also responsible for mapping content-type values
to Serde serializers.
Required Associated Types§
Required Methods§
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.