Enum rocket_http::Method
source · [−]pub enum Method {
Get,
Put,
Post,
Delete,
Options,
Head,
Trace,
Connect,
Patch,
}Expand description
Representation of HTTP methods.
(De)serialization
Method is both Serialize and Deserialize, represented as an
uncased string. For example, Method::Get serializes to
"GET" and deserializes from any casing of "GET" including "get",
"GeT", and "GET".
use serde::{Serialize, Deserialize};
use rocket::http::Method;
#[derive(Deserialize, Serialize)]
struct Foo {
method: Method,
}Variants
Get
The GET variant.
Put
The PUT variant.
Post
The POST variant.
Delete
The DELETE variant.
Options
The OPTIONS variant.
Head
The HEAD variant.
Trace
The TRACE variant.
Connect
The CONNECT variant.
Patch
The PATCH variant.
Implementations
sourceimpl Method
impl Method
sourcepub fn supports_payload(self) -> bool
pub fn supports_payload(self) -> bool
Returns true if an HTTP request with the method represented by self
always supports a payload.
The following methods always support payloads:
PUT,POST,DELETE,PATCH
The following methods do not always support payloads:
GET,HEAD,CONNECT,TRACE,OPTIONS
Example
use rocket::http::Method;
assert_eq!(Method::Get.supports_payload(), false);
assert_eq!(Method::Post.supports_payload(), true);Trait Implementations
impl Copy for Method
impl Eq for Method
impl StructuralEq for Method
impl StructuralPartialEq for Method
Auto Trait Implementations
impl RefUnwindSafe for Method
impl Send for Method
impl Sync for Method
impl Unpin for Method
impl UnwindSafe for Method
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more