pub trait SerializeRequest<'a, T, W> {
// Required methods
fn content_type(runtime: &ConjureRuntime, value: &T) -> HeaderValue;
fn serialize(
runtime: &ConjureRuntime,
value: T,
) -> Result<RequestBody<'a, W>, Error>;
// Provided method
fn content_length(runtime: &ConjureRuntime, value: &T) -> Option<u64> { ... }
}
Expand description
A trait implemented by request body serializers used by custom Conjure client trait implementations.
Required Methods§
Sourcefn content_type(runtime: &ConjureRuntime, value: &T) -> HeaderValue
fn content_type(runtime: &ConjureRuntime, value: &T) -> HeaderValue
Returns the body’s content type.
Sourcefn serialize(
runtime: &ConjureRuntime,
value: T,
) -> Result<RequestBody<'a, W>, Error>
fn serialize( runtime: &ConjureRuntime, value: T, ) -> Result<RequestBody<'a, W>, Error>
Serializes the body.
Provided Methods§
Sourcefn content_length(runtime: &ConjureRuntime, value: &T) -> Option<u64>
fn content_length(runtime: &ConjureRuntime, value: &T) -> Option<u64>
Returns the body’s length, if known.
Empty and fixed size bodies will have their content length filled in automatically.
The default implementation returns None
.
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.