#[non_exhaustive]pub enum Method {
Get,
Put,
Post,
Delete,
Options,
Head,
Patch,
Trace,
Query,
}Expand description
An HTTP method that has a dedicated Path Item field.
#[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
Get
GET.
Put
PUT.
Post
POST.
Delete
DELETE.
Options
OPTIONS.
Head
HEAD.
Patch
PATCH.
Trace
TRACE.
Query
QUERY, as defined by the HTTP QUERY method draft.
Introduced in OpenAPI 3.2.
Implementations§
Source§impl Method
impl Method
Sourcepub fn as_wire_str(self) -> &'static str
pub fn as_wire_str(self) -> &'static str
The method name as it appears on the wire.
Sourcepub fn from_wire_str(name: &str) -> Option<Self>
pub fn from_wire_str(name: &str) -> Option<Self>
The method with this wire spelling, if it has a Path Item field.
Case-sensitive: HTTP method tokens are, and a description that spelled
one differently would not be describing the same request. Returns
None for a method OpenAPI has no field for, which is a different
answer from “not a method” — under openapi32 those reach a Path Item
through additionalOperations instead.
Trait Implementations§
impl Copy for Method
Source§impl<'de> Deserialize<'de> for Method
impl<'de> Deserialize<'de> for Method
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Method
Source§impl From<Method> for Method
Available on crate feature http only.A described method has a wire spelling, so this direction never fails.
impl From<Method> for Method
http only.A described method has a wire spelling, so this direction never fails.
The pair exists because kynos exposes both this type and http::Method
in adjacent APIs — an Observer receives a request’s method and a route’s
— and could not write the conversion itself: both types are foreign to it,
so the orphan rule puts these here.
Source§impl Ord for Method
impl Ord for Method
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 PartialOrd for Method
impl PartialOrd for Method
impl StructuralPartialEq for Method
Source§impl TryFrom<&Method> for Method
Available on crate feature http only.Not every HTTP method is one a Path Item has a field for.
impl TryFrom<&Method> for Method
http only.Not every HTTP method is one a Path Item has a field for.
Fallible on purpose, and in two ways worth telling apart in a message
rather than in the type: an extension method has no variant at all, and
QUERY has one only under openapi32. Both reach a Path Item through
additionalOperations, which is 3.2’s answer and not a conversion.
Auto Trait Implementations§
impl Freeze for Method
impl RefUnwindSafe for Method
impl Send for Method
impl Sync for Method
impl Unpin for Method
impl UnsafeUnpin for Method
impl UnwindSafe for Method
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
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.