http_parser/
http_method.rs

1/// `HttpMethod` defines supported HTTP methods.
2#[derive(PartialEq, Eq, Clone, Copy)]
3pub enum HttpMethod {
4    Delete,
5    Get,
6    Head,
7    Post,
8    Put,
9    // pathological
10    Connect,
11    Options,
12    Trace,
13    // webdav
14    Copy,
15    Lock,
16    MKCol,
17    Move,
18    PropFind,
19    PropPatch,
20    Search,
21    Unlock,
22    // subversion
23    Report,
24    MKActivity,
25    Checkout,
26    Merge,
27    // upnp
28    MSearch,
29    Notify,
30    Subscribe,
31    Unsubscribe,
32    // RFC-5789
33    Patch,
34    Purge,
35    // CalDAV
36    MKCalendar,
37}
38
39impl ToString for HttpMethod {
40    fn to_string(&self) -> String {
41        match *self {
42            HttpMethod::Delete      => "DELETE".to_string(),
43            HttpMethod::Get         => "GET".to_string(),
44            HttpMethod::Head        => "HEAD".to_string(),
45            HttpMethod::Post        => "POST".to_string(),
46            HttpMethod::Put         => "Put".to_string(),
47            HttpMethod::Connect     => "CONNECT".to_string(),
48            HttpMethod::Options     => "OPTIONS".to_string(),
49            HttpMethod::Trace       => "TRACE".to_string(),
50            HttpMethod::Copy        => "COPY".to_string(),
51            HttpMethod::Lock        => "LOCK".to_string(),
52            HttpMethod::MKCol       => "MKCOL".to_string(),
53            HttpMethod::Move        => "MOVE".to_string(),
54            HttpMethod::PropFind    => "PROPFIND".to_string(),
55            HttpMethod::PropPatch   => "PROPPATCH".to_string(),
56            HttpMethod::Search      => "SEARCH".to_string(),
57            HttpMethod::Unlock      => "UNLOCK".to_string(),
58            HttpMethod::Report      => "REPORT".to_string(),
59            HttpMethod::MKActivity  => "MKACTIVITY".to_string(),
60            HttpMethod::Checkout    => "CHECKOUT".to_string(),
61            HttpMethod::Merge       => "MERGE".to_string(),
62            HttpMethod::MSearch     => "M-SEARCH".to_string(),
63            HttpMethod::Notify      => "NOTIFY".to_string(),
64            HttpMethod::Subscribe   => "SUBSCRIBE".to_string(),
65            HttpMethod::Unsubscribe => "UNSUBSCRIBE".to_string(),
66            HttpMethod::Patch       => "PATCH".to_string(),
67            HttpMethod::Purge       => "PURGE".to_string(),
68            HttpMethod::MKCalendar  => "MKCALENDAR".to_string(),
69        }
70    }
71}