Skip to main content

Style

Enum Style 

Source
#[non_exhaustive]
pub enum Style { Matrix, Label, Simple, Form, SpaceDelimited, PipeDelimited, DeepObject, Cookie, }
Expand description

How a parameter value is serialized.

Not every combination of style and location is legal; OpenAPI 3.2 states that the table of valid combinations is closed. crate::validate checks the pairing. #[non_exhaustive] because OpenAPI 3.2 adds to this and the addition is #[cfg]-gated. Cargo unifies features across a dependency graph, so any crate enabling openapi32 enables it for every crate in the build – and without this attribute that would turn a downstream exhaustive match into a compile error, which is not what “purely additive” is supposed to mean.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Matrix

Path-style parameters defined by RFC 6570. Path only.

§

Label

Label-style expansion defined by RFC 6570. Path only.

§

Simple

Comma-separated values. The default for path and header.

§

Form

Form-style expansion. The default for query and cookie.

§

SpaceDelimited

Space-separated array or object values. Query only.

§

PipeDelimited

Pipe-separated array or object values. Query only.

§

DeepObject

Nested objects rendered as param[prop]=value.

Query only, and defined only for objects whose properties are scalars. Anything deeper needs ParameterIn::Querystring.

§

Cookie

Cookie-style serialization.

Introduced in OpenAPI 3.2. Cookie only.

Implementations§

Source§

impl Style

Source

pub fn default_for(location: ParameterIn) -> Self

The style applied when none is stated, given a parameter location.

Source

pub fn is_valid_for(self, location: ParameterIn) -> bool

Whether this style may be used at the given location.

Source

pub fn default_explode(self) -> bool

Whether explode defaults to true for this style.

The two styles that pair a name with each value default to exploding; every other style defaults to false.

Trait Implementations§

Source§

impl Clone for Style

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Style

Source§

impl Debug for Style

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Style

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Style

Source§

impl From<EncodingStyle> for Style

Source§

fn from(style: EncodingStyle) -> Self

Converts to this type from the input type.
Source§

impl From<HeaderStyle> for Style

Source§

fn from(_: HeaderStyle) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Style

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Style

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Style

Auto Trait Implementations§

§

impl Freeze for Style

§

impl RefUnwindSafe for Style

§

impl Send for Style

§

impl Sync for Style

§

impl Unpin for Style

§

impl UnsafeUnpin for Style

§

impl UnwindSafe for Style

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.