#[non_exhaustive]pub enum SpecVersion {
V3_1,
V3_2,
}Expand description
The version of the OpenAPI Specification a document targets.
#[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.
The same reasoning marks Method,
ParameterIn, Style,
ExampleValue and
SecurityScheme. Matching one takes a wildcard
arm, in either build:
fn label(version: SpecVersion) -> &'static str {
match version {
SpecVersion::V3_1 => "3.1",
_ => "newer",
}
}Without one it does not compile, which is the guarantee: this is the error
a downstream crate would otherwise have met the day something else in its
build turned openapi32 on.
fn label(version: SpecVersion) -> &'static str {
match version {
SpecVersion::V3_1 => "3.1",
}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Implementations§
Source§impl SpecVersion
impl SpecVersion
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The version string emitted in the openapi field.
Kynos implements the 3.1.2 and 3.2.0 texts. Patch releases of the specification are clarifying rather than breaking, so a consumer that understands 3.1 understands anything emitted here.
Sourcepub fn supports_3_2(self) -> bool
pub fn supports_3_2(self) -> bool
Whether this version is at least 3.2.
Trait Implementations§
Source§impl Clone for SpecVersion
impl Clone for SpecVersion
impl Copy for SpecVersion
Source§impl Debug for SpecVersion
impl Debug for SpecVersion
Source§impl Default for SpecVersion
impl Default for SpecVersion
Source§impl Display for SpecVersion
impl Display for SpecVersion
impl Eq for SpecVersion
Source§impl Ord for SpecVersion
impl Ord for SpecVersion
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SpecVersion
impl PartialEq for SpecVersion
Source§impl PartialOrd for SpecVersion
impl PartialOrd for SpecVersion
impl StructuralPartialEq for SpecVersion
Auto Trait Implementations§
impl Freeze for SpecVersion
impl RefUnwindSafe for SpecVersion
impl Send for SpecVersion
impl Sync for SpecVersion
impl Unpin for SpecVersion
impl UnsafeUnpin for SpecVersion
impl UnwindSafe for SpecVersion
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.