Skip to main content

foxtive_ntex_multipart/
data_input.rs

1use std::str::FromStr;
2
3#[derive(Debug, Default, Clone)]
4pub struct DataInput {
5    pub name: String,
6    pub value: String,
7}
8
9impl DataInput {
10    pub fn get<T: FromStr>(&self) -> Result<T, T::Err> {
11        self.value.parse::<T>()
12    }
13
14    pub fn inner(&self) -> &DataInput {
15        self
16    }
17
18    pub fn into_inner(self) -> DataInput {
19        self
20    }
21
22    pub fn parts(&self) -> (&String, &String) {
23        (&self.name, &self.value)
24    }
25
26    pub fn into_parts(self) -> (String, String) {
27        (self.name, self.value)
28    }
29}