#[non_exhaustive]pub enum ExampleValue {
Embedded(Value),
#[non_exhaustive] External {
uri: String,
data: Option<Value>,
},
Data {
data: Value,
serialized: Option<String>,
},
Serialized(String),
}Expand description
The example itself, in whichever form carries it.
The specification’s exclusions are asymmetric, so this is not a one-of over
four fields. value excludes all three others; serializedValue and
externalValue exclude each other; but dataValue pairs with either of
them, which is how the specification’s own worked examples are written. The
variants below are exactly the combinations that leaves.
#[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
Embedded(Value)
An embedded literal example, written to value.
Exclusive with every other form. Deprecated by 3.2 for non-JSON serialization targets; see the type-level documentation.
Named for what it is rather than for its field: a variant called Value
would collide with serde_json::Value in rustc’s shortest-path table
and lengthen that type’s name in every diagnostic mentioning it, this
crate’s or anyone else’s.
#[non_exhaustive]External
A URI identifying the serialized example, written to externalValue.
For payloads that cannot be embedded in JSON or YAML.
#[non_exhaustive] on the variant, because 3.2 adds data to it.
The attribute on the enum covers a variant being added and says nothing
about this one’s field list; see the type’s own documentation.
Fields
This variant is marked as non-exhaustive
Data
The example as data, written to dataValue.
Introduced in OpenAPI 3.2.
Fields
Serialized(String)
The example exactly as it appears on the wire, written to
serializedValue, with no data form given.
Introduced in OpenAPI 3.2.
Trait Implementations§
Source§impl Clone for ExampleValue
impl Clone for ExampleValue
Source§impl Debug for ExampleValue
impl Debug for ExampleValue
impl Eq for ExampleValue
Source§impl PartialEq for ExampleValue
impl PartialEq for ExampleValue
impl StructuralPartialEq for ExampleValue
Auto Trait Implementations§
impl Freeze for ExampleValue
impl RefUnwindSafe for ExampleValue
impl Send for ExampleValue
impl Sync for ExampleValue
impl Unpin for ExampleValue
impl UnsafeUnpin for ExampleValue
impl UnwindSafe for ExampleValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.