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
|
#[derive(Debug, Clone)]
pub enum Method {
Get,
Head,
Post,
Put,
Delete,
Connect,
Options,
Trace,
Patch
}
impl Method {
pub fn serialize(string: &str) -> Option<Self> {
match string {
"GET" => Some(Self::Get),
"HEAD" => Some(Self::Head),
"POST" => Some(Self::Post),
"PUT" => Some(Self::Put),
"DELETE" => Some(Self::Delete),
"CONNECT" => Some(Self::Connect),
"OPTIONS" => Some(Self::Options),
"TRACE" => Some(Self::Trace),
"PATCH" => Some(Self::Patch),
_ => None
}
}
}
|