windjammer_ui/components/generated/
input.rs

1#![allow(clippy::all)]
2#![allow(noop_method_call)]
3use super::traits::Renderable;
4
5#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
6pub struct Input {
7    pub value: String,
8    pub placeholder: String,
9    pub input_type: String,
10}
11
12impl Input {
13    #[inline]
14    pub fn new() -> Input {
15        Input {
16            value: "".to_string(),
17            placeholder: "".to_string(),
18            input_type: "text".to_string(),
19        }
20    }
21    #[inline]
22    pub fn value(mut self, value: String) -> Input {
23        self.value = value;
24        self
25    }
26    #[inline]
27    pub fn placeholder(mut self, placeholder: String) -> Input {
28        self.placeholder = placeholder;
29        self
30    }
31    #[inline]
32    pub fn input_type(mut self, input_type: String) -> Input {
33        self.input_type = input_type;
34        self
35    }
36}
37
38impl Renderable for Input {
39    #[inline]
40    fn render(self) -> String {
41        format!(
42            "<input class='wj-input' type='{}' value='{}' placeholder='{}'/>",
43            self.input_type, self.value, self.placeholder
44        )
45    }
46}