[−][src]Trait tower_web::response::Serializer
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.
Associated Types
type Format: Clone + Send + Sync + 'static
A token used by Serializer
implementations to identify the specific
serialization format to use when encoding a value.
Required methods
fn lookup(&self, name: &str) -> Option<ContentType<Self::Format>>
Lookup a serializer and HeaderValue
for the given Content-Type
string.
fn serialize<T>(
&self,
value: &T,
format: &Self::Format,
context: &SerializerContext
) -> Result<Bytes, Error> where
T: Serialize,
&self,
value: &T,
format: &Self::Format,
context: &SerializerContext
) -> Result<Bytes, Error> where
T: Serialize,
Serialize the value using the specified format.
Implementations on Foreign Types
impl Serializer for ()
[src]
type Format = Void
fn lookup(&self, _: &str) -> Option<ContentType<Self::Format>>
[src]
fn serialize<T>(
&self,
_: &T,
_: &Self::Format,
_: &SerializerContext
) -> Result<Bytes, Error> where
T: Serialize,
[src]
&self,
_: &T,
_: &Self::Format,
_: &SerializerContext
) -> Result<Bytes, Error> where
T: Serialize,
impl<T, U> Serializer for (T, U) where
T: Serializer,
U: Serializer,
[src]
T: Serializer,
U: Serializer,
type Format = Either2<T::Format, U::Format>
fn lookup(&self, name: &str) -> Option<ContentType<Self::Format>>
[src]
fn serialize<V>(
&self,
value: &V,
format: &Self::Format,
context: &SerializerContext
) -> Result<Bytes, Error> where
V: Serialize,
[src]
&self,
value: &V,
format: &Self::Format,
context: &SerializerContext
) -> Result<Bytes, Error> where
V: Serialize,
Implementors
impl Serializer for Handlebars
[src]
type Format = ()
fn lookup(&self, name: &str) -> Option<ContentType<Self::Format>>
[src]
fn serialize<T>(
&self,
value: &T,
_: &Self::Format,
context: &SerializerContext
) -> Result<Bytes, Error> where
T: Serialize,
[src]
&self,
value: &T,
_: &Self::Format,
context: &SerializerContext
) -> Result<Bytes, Error> where
T: Serialize,
impl<T> Serializer for DefaultSerializer<T> where
T: Serializer,
[src]
T: Serializer,