The Request Method (VERB)
This type also contains constants for a number of common HTTP methods such
as GET, POST, etc.
Currently includes 8 variants representing the 8 methods defined in
RFC 7230, plus PATCH,
and an Extension variant for all extensions.
use http::Method;
assert_eq!(Method::GET, Method::from_bytes(b"GET").unwrap());
assert!(Method::GET.is_idempotent());
assert_eq!(Method::POST.as_str(), "POST");
GET: Method = Method(Get)
GET
POST: Method = Method(Post)
POST
PUT: Method = Method(Put)
PUT
DELETE: Method = Method(Delete)
DELETE
HEAD: Method = Method(Head)
HEAD
OPTIONS: Method = Method(Options)
OPTIONS
CONNECT: Method = Method(Connect)
CONNECT
PATCH: Method = Method(Patch)
PATCH
TRACE: Method = Method(Trace)
TRACE
Converts a slice of bytes to an HTTP method.
Whether a method is considered "safe", meaning the request is
essentially read-only.
See the spec
for more words.
Whether a method is considered "idempotent", meaning the request has
the same result if executed multiple times.
See the spec for
more words.
Return a &str representation of the HTTP method
Performs copy-assignment from source
. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Feeds this value into the given [Hasher
]. Read more
Feeds a slice of this type into the given [Hasher
]. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
[−]
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used by ==
. Read more
[−]
This method tests for !=
.
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Returns the "default value" for a type. Read more
Associated error with the conversion this implementation represents.
Associated error with the conversion this implementation represents.
The associated error which can be returned from parsing.
Parses a string s
to return a value of this type. Read more
Associated error with the conversion this implementation represents.