Struct http::method::Method[][src]

pub struct Method(_);

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.

Examples

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");

Methods

impl Method
[src]

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

Trait Implementations

impl Clone for Method
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Method
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Method
[src]

impl Hash for Method
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl AsRef<str> for Method
[src]

Performs the conversion.

impl PartialEq<str> for Method
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialEq<&'a str> for Method
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Debug for Method
[src]

Formats the value using the given formatter. Read more

impl Display for Method
[src]

Formats the value using the given formatter. Read more

impl Default for Method
[src]

Returns the "default value" for a type. Read more

impl<'a> HttpTryFrom<&'a [u8]> for Method
[src]

Associated error with the conversion this implementation represents.

impl<'a> HttpTryFrom<&'a str> for Method
[src]

Associated error with the conversion this implementation represents.

impl FromStr for Method
[src]

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

impl HttpTryFrom<Method> for Method
[src]

Associated error with the conversion this implementation represents.

Auto Trait Implementations

impl Send for Method

impl Sync for Method