[−][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]
impl Serializer for ()type Format = Void
fn lookup(&self, _: &str) -> Option<ContentType<Self::Format>>[src]
fn lookup(&self, _: &str) -> Option<ContentType<Self::Format>>fn serialize<T>(
&self,
_: &T,
_: &Self::Format,
_: &SerializerContext
) -> Result<Bytes, Error> where
T: Serialize, [src]
fn serialize<T>(
&self,
_: &T,
_: &Self::Format,
_: &SerializerContext
) -> Result<Bytes, Error> where
T: Serialize, impl<T, U> Serializer for (T, U) where
T: Serializer,
U: Serializer, [src]
impl<T, U> Serializer for (T, U) where
T: Serializer,
U: Serializer, type Format = Either2<T::Format, U::Format>
fn lookup(&self, name: &str) -> Option<ContentType<Self::Format>>[src]
fn lookup(&self, name: &str) -> Option<ContentType<Self::Format>>fn serialize<V>(
&self,
value: &V,
format: &Self::Format,
context: &SerializerContext
) -> Result<Bytes, Error> where
V: Serialize, [src]
fn serialize<V>(
&self,
value: &V,
format: &Self::Format,
context: &SerializerContext
) -> Result<Bytes, Error> where
V: Serialize, Implementors
impl Serializer for Handlebars[src]
impl Serializer for Handlebarstype Format = ()
fn lookup(&self, name: &str) -> Option<ContentType<Self::Format>>[src]
fn lookup(&self, name: &str) -> Option<ContentType<Self::Format>>fn serialize<T>(
&self,
value: &T,
_: &Self::Format,
context: &SerializerContext
) -> Result<Bytes, Error> where
T: Serialize, [src]
fn serialize<T>(
&self,
value: &T,
_: &Self::Format,
context: &SerializerContext
) -> Result<Bytes, Error> where
T: Serialize, impl<T> Serializer for DefaultSerializer<T> where
T: Serializer, [src]
impl<T> Serializer for DefaultSerializer<T> where
T: Serializer,