#[non_exhaustive]pub enum Method {
Get,
Head,
Post,
Put,
Delete,
Connect,
Options,
Trace,
Patch,
Other,
}Expand description
The request method.
Methods are case-sensitive (RFC 9110 section 9.1): get is a different,
unregistered method and parses as Method::Other. The exact text is
always available from RequestHead::method_str.
§Examples
use http_net::Method;
assert_eq!(Method::from_bytes(b"GET"), Method::Get);
assert_eq!(Method::from_bytes(b"get"), Method::Other);
assert_eq!(Method::Post.as_str(), Some("POST"));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Get
GET
Head
HEAD: the response carries headers but never a body.
Post
POST
Put
PUT
Delete
DELETE
Connect
CONNECT: the target is in authority form; a 2xx response turns the
connection into a tunnel.
Options
OPTIONS: the only method that may use the * target.
Trace
TRACE
Patch
PATCH
Other
Any other token.
Implementations§
Trait Implementations§
impl Copy for Method
impl Eq for Method
impl StructuralPartialEq for Method
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
Mutably borrows from an owned value. Read more