pub enum Method {
Get,
Post,
Put,
Head,
Delete,
Patch,
Options,
}
Expand description
Available methods for HTTP Requests
Variants
Get
Get method
Post
Post method
Put
Put method
Head
Head method
Delete
Delete method
Patch
Patch method
Options
Options method
Implementations
sourceimpl Method
impl Method
sourcepub fn to<T: Sync, F: Callback<A> + Send + Sync + 'static, A: Extractor<T>>(
self,
handler: F
) -> MethodHandler<T>
pub fn to<T: Sync, F: Callback<A> + Send + Sync + 'static, A: Extractor<T>>(
self,
handler: F
) -> MethodHandler<T>
Turns the Method into a MethodHandler, which is a short for a tuple Method - Handler
sourcepub fn from_str<T: AsRef<str>>(source: T) -> Option<Method>
pub fn from_str<T: AsRef<str>>(source: T) -> Option<Method>
Casts a method from a string.
assert_eq!(Some(Method::Get), Method::from_str("GET"));
sourcepub fn to_str(&self) -> &'static str
pub fn to_str(&self) -> &'static str
Retrieves the str
representation of a method (all caps).
assert_eq!("GET", Method::Get.to_str());
sourcepub fn and(self, rhs: Method) -> MultipleMethod
pub fn and(self, rhs: Method) -> MultipleMethod
Makes a MultipleMethod
In case you want a function to reply to more than one method, you can put as many as you want with the and
method.
let mul = Method::Get.and(Method::Post);
Trait Implementations
impl Eq 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 · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more