Skip to main content

motorcortex_rust/client/
parameters.rs

1pub trait Parameters {
2    fn into_vec(self) -> Vec<String>;
3}
4
5impl Parameters for &str {
6    fn into_vec(self) -> Vec<String> {
7        vec![self.to_string()]
8    }
9}
10
11impl Parameters for Vec<String> {
12    fn into_vec(self) -> Vec<String> {
13        self
14    }
15}
16
17impl<'a> Parameters for &'a [&'a str] {
18    fn into_vec(self) -> Vec<String> {
19        self.iter().map(|s| s.to_string()).collect()
20    }
21}
22
23impl<const N: usize> Parameters for [&str; N] {
24    fn into_vec(self) -> Vec<String> {
25        self.iter().map(|s| s.to_string()).collect()
26    }
27}