[][src]Enum ctchi::core::http::HttpMethod

pub enum HttpMethod {
    GET,
    POST,
    PUT,
    DELETE,
    OPTIONS,
    HEAD,
    CONNECT,
    TRACE,
    PATCH,
    UNKNOWN,
}

Represent HTTP method + unknown value in case we are missing something in enum or client send us wrong request.

Variants

GET
POST
PUT
DELETE
OPTIONS
HEAD
CONNECT
TRACE
PATCH
UNKNOWN

Implementations

impl HttpMethod[src]

pub fn parse(method_str: &str) -> HttpMethod[src]

Build HttpMethod enum from string. If it is valid HTTP method we get appropriate value. Otherwise we get HttpMethod::UNKNOWN

Arguments:

  • method_str - string which contains HTTP method representation

Example

use ctchi::core::http::HttpMethod;
assert!(HttpMethod::parse("GET") == HttpMethod::GET);
assert!(HttpMethod::parse("POST") == HttpMethod::POST);
assert!(HttpMethod::parse("PUT") == HttpMethod::PUT);
assert!(HttpMethod::parse("SOMETHING") == HttpMethod::UNKNOWN);

Trait Implementations

impl PartialEq<HttpMethod> for HttpMethod[src]

impl StructuralPartialEq for HttpMethod[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.