http_type/methods/
impl.rs1use crate::*;
2use std::fmt::{self, Display};
3
4impl Default for Methods {
5 #[inline]
6 fn default() -> Self {
7 Self::GET
8 }
9}
10
11impl Methods {
13 #[inline]
17 pub fn new() -> Self {
18 Self::default()
19 }
20
21 #[inline]
25 pub fn is_get(&self) -> bool {
26 self.to_owned() == Self::GET.to_owned()
27 }
28
29 #[inline]
33 pub fn is_post(&self) -> bool {
34 self.to_owned() == Self::POST.to_owned()
35 }
36}
37
38impl Display for Methods {
39 #[inline]
40 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41 let res: &str = match self {
42 Self::GET => GET,
43 Self::POST => POST,
44 };
45 write!(f, "{}", res)
46 }
47}