Struct EncodingBuilder

Source
pub struct EncodingBuilder<S: State = Empty> { /* private fields */ }
Expand description

Use builder syntax to set the inputs and finish with build().

Implementations§

Source§

impl<S: State> EncodingBuilder<S>

Source

pub fn build(self) -> Encoding
where S: IsComplete,

Finish building and return the requested object

Source

pub fn content_type(self, value: String) -> EncodingBuilder<SetContentType<S>>
where S::ContentType: IsUnset,

Optional (Some / Option setters).

The Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binary – application/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.

Source

pub fn maybe_content_type( self, value: Option<String>, ) -> EncodingBuilder<SetContentType<S>>
where S::ContentType: IsUnset,

Optional (Some / Option setters).

The Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binary – application/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.

Source

pub fn headers( self, value: IndexMap<String, Header>, ) -> EncodingBuilder<SetHeaders<S>>
where S::Headers: IsUnset,

Optional (Some / Option setters). Default: <IndexMap<String, Header> as Default>::default().

A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart.

Source

pub fn maybe_headers( self, value: Option<IndexMap<String, Header>>, ) -> EncodingBuilder<SetHeaders<S>>
where S::Headers: IsUnset,

Optional (Some / Option setters). Default: <IndexMap<String, Header> as Default>::default().

A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart.

Source

pub fn style(self, value: ParameterStyle) -> EncodingBuilder<SetStyle<S>>
where S::Style: IsUnset,

Optional (Some / Option setters).

Describes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.

Source

pub fn maybe_style( self, value: Option<ParameterStyle>, ) -> EncodingBuilder<SetStyle<S>>
where S::Style: IsUnset,

Optional (Some / Option setters).

Describes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.

Source

pub fn explode(self, value: bool) -> EncodingBuilder<SetExplode<S>>
where S::Explode: IsUnset,

Optional (Some / Option setters).

When this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.

Source

pub fn maybe_explode( self, value: Option<bool>, ) -> EncodingBuilder<SetExplode<S>>
where S::Explode: IsUnset,

Optional (Some / Option setters).

When this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.

Source

pub fn allow_reserved(self, value: bool) -> EncodingBuilder<SetAllowReserved<S>>
where S::AllowReserved: IsUnset,

Optional (Some / Option setters).

Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.

Source

pub fn maybe_allow_reserved( self, value: Option<bool>, ) -> EncodingBuilder<SetAllowReserved<S>>
where S::AllowReserved: IsUnset,

Optional (Some / Option setters).

Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.

Source

pub fn extensions(self, value: Extensions) -> EncodingBuilder<SetExtensions<S>>
where S::Extensions: IsUnset,

Optional (Some / Option setters).

Optional extensions “x-something”.

Source

pub fn maybe_extensions( self, value: Option<Extensions>, ) -> EncodingBuilder<SetExtensions<S>>
where S::Extensions: IsUnset,

Optional (Some / Option setters).

Optional extensions “x-something”.

Trait Implementations§

Source§

impl<S: IsComplete> From<EncodingBuilder<S>> for Encoding

Source§

fn from(builder: EncodingBuilder<S>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<S> Freeze for EncodingBuilder<S>

§

impl<S> RefUnwindSafe for EncodingBuilder<S>

§

impl<S> Send for EncodingBuilder<S>

§

impl<S> Sync for EncodingBuilder<S>

§

impl<S> Unpin for EncodingBuilder<S>

§

impl<S> UnwindSafe for EncodingBuilder<S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.