rustify/
enums.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Contains common enums used across the crate

/// Represents a HTTP request method
#[derive(Clone, Debug)]
pub enum RequestMethod {
    CONNECT,
    DELETE,
    GET,
    HEAD,
    LIST,
    OPTIONS,
    PATCH,
    POST,
    PUT,
    TRACE,
}

#[allow(clippy::from_over_into)]
impl Into<http::Method> for RequestMethod {
    fn into(self) -> http::Method {
        match self {
            RequestMethod::CONNECT => http::Method::CONNECT,
            RequestMethod::DELETE => http::Method::DELETE,
            RequestMethod::GET => http::Method::GET,
            RequestMethod::HEAD => http::Method::HEAD,
            RequestMethod::LIST => http::Method::from_bytes("LIST".as_bytes()).unwrap(),
            RequestMethod::OPTIONS => http::Method::OPTIONS,
            RequestMethod::PATCH => http::Method::PATCH,
            RequestMethod::POST => http::Method::POST,
            RequestMethod::PUT => http::Method::PUT,
            RequestMethod::TRACE => http::Method::TRACE,
        }
    }
}

/// Represents the type of a HTTP request body
#[derive(Clone, Debug)]
pub enum RequestType {
    JSON,
}

/// Represents the type of a HTTP response body
#[derive(Clone, Debug)]
pub enum ResponseType {
    JSON,
}