1use std::str::FromStr;
2
3use hyper::Method;
4
5pub trait IntoMethods {
6 fn into_methods(self) -> Vec<Method>;
7}
8
9impl IntoMethods for &str {
10 fn into_methods(self) -> Vec<Method> {
11 self.split(',')
12 .map(|m| Method::from_str(m.trim()).unwrap())
13 .collect::<Vec<_>>()
14 }
15}
16
17impl IntoMethods for Vec<Method> {
18 fn into_methods(self) -> Vec<Method> {
19 self
20 }
21}
22
23impl IntoMethods for Method {
24 fn into_methods(self) -> Vec<Method> {
25 vec![self]
26 }
27}
28
29impl IntoMethods for &[Method] {
30 fn into_methods(self) -> Vec<Method> {
31 self.to_vec()
32 }
33}