pub struct RangeInputConfigs {
pub max: f64,
pub min: f64,
pub step: Option<f64>,
}Expand description
The range input configs.
max: The range max value.min: The range min value.step: The range step value.
Fields§
§max: f64§min: f64§step: Option<f64>Implementations§
Source§impl RangeInputConfigs
impl RangeInputConfigs
Sourcepub fn new(min: f64, max: f64) -> Self
pub fn new(min: f64, max: f64) -> Self
Creates a new object.
min: The range input’s minimum value.max: The range input’s maximum value.
Examples found in repository?
examples/forms.rs (line 155)
86 fn as_form_field(&self) -> Option<Element> {
87 let model_name_field = create_label_text_field(
88 InputFieldConfig::new(
89 "model-name".to_string(),
90 "model-name".to_string(),
91 "Model name".to_string(),
92 ),
93 TextInputConfig::new().with_place_holder("Enter model name".to_string()),
94 Some(self.model_name.clone()),
95 );
96 let brand_field = self.brand.as_form_field().unwrap();
97 let vehicul_fieldset = wrap_fields_in_fieldset(
98 vec![model_name_field, brand_field],
99 "Vehicule model".to_string(),
100 HtmlElementConfig::new_empty(),
101 HtmlElementConfig::new_empty(),
102 );
103
104 let motor_fieldset = wrap_fields_in_fieldset(
105 vec![self.motor.as_form_field().unwrap()],
106 "Motor".to_string(),
107 HtmlElementConfig::new_empty(),
108 HtmlElementConfig::new_empty(),
109 );
110
111 let color_input = color_input::create_labeled_color_input(
112 InputFieldConfig::new(
113 "color".to_string(),
114 "color".to_string(),
115 "color".to_string(),
116 ),
117 Some(self.color.clone()),
118 );
119
120 let date_input = date_input::create_date_input_with_label(
121 InputFieldConfig::new(
122 "bought_the".to_string(),
123 "bought_the".to_string(),
124 "Bought the".to_string(),
125 ),
126 DateInputConfig::new(false),
127 Some(self.bought_the.clone()),
128 );
129 let dealership = self.dealership.as_form_field().unwrap();
130 let hidden = create_hidden_input(
131 InputFieldConfig::new(
132 "hidden-id".to_string(),
133 "hidden-id".to_string(),
134 "".to_string(),
135 ),
136 Some(self.hidden_id.clone()),
137 );
138
139 let power = create_labeled_number_input(
140 InputFieldConfig::new(
141 "hidden-id".to_string(),
142 "hidden-id".to_string(),
143 "".to_string(),
144 ),
145 NumberInputConfigs::new(),
146 Some(self.power),
147 );
148
149 let size = create_labeled_range_input(
150 InputFieldConfig::new(
151 "size".to_string(),
152 "size".to_string(),
153 "Size filter".to_string(),
154 ),
155 RangeInputConfigs::new(3.0, 6.0),
156 Some(self.length),
157 );
158
159 let start = create_labeled_time_input(
160 InputFieldConfig::new(
161 "reset".to_string(),
162 "reset".to_string(),
163 "Reset form".to_string(),
164 ),
165 TimeInputConfigs::new(),
166 Some(self.last_start_time.clone()),
167 );
168
169 let benchmark = create_labeled_week_input(
170 InputFieldConfig::new(
171 "bencmark".to_string(),
172 "bencmark".to_string(),
173 "Benchmark week".to_string(),
174 ),
175 WeekInputConfigs::new(),
176 Some(self.benchmark_week.clone()),
177 );
178
179 let description = create_labeled_text_area(
180 InputFieldConfig::new(
181 "description".to_string(),
182 "description".to_string(),
183 "Description".to_string(),
184 ),
185 TextAreaInputConfigs::new(),
186 Some(self.description.clone()),
187 );
188
189 let tires = self.tyres.as_form_field().unwrap();
190
191 let reset = create_labeled_reset_input(
192 InputFieldConfig::new(
193 "reset".to_string(),
194 "reset".to_string(),
195 "Reset form".to_string(),
196 ),
197 Some("reset".to_string()),
198 );
199
200 let submit = create_submit_input(
201 InputFieldConfig::new(
202 "submit".to_string(),
203 "submit".to_string(),
204 "submit".to_string(),
205 ),
206 SubmitInputConfigs::new(),
207 );
208
209 create_form(
210 vec![
211 vehicul_fieldset,
212 color_input,
213 motor_fieldset,
214 date_input,
215 dealership,
216 hidden,
217 power,
218 size,
219 benchmark,
220 description,
221 tires,
222 start,
223 reset,
224 submit,
225 ],
226 FormConfig::new().with_method("POST".to_string()),
227 HtmlElementConfig::new_empty(),
228 )
229 }Sourcepub fn with_max(self, max: f64) -> Self
pub fn with_max(self, max: f64) -> Self
Sets the new max parameter.
max: The new max parameter.
Sourcepub fn with_min(self, min: f64) -> Self
pub fn with_min(self, min: f64) -> Self
Sets the new min parameter.
min: The new min parameter.
Sourcepub fn with_step(self, step: f64) -> Self
pub fn with_step(self, step: f64) -> Self
Sets the step parameter.
step: The new step parameter.
Sourcepub fn without_step(self) -> Self
pub fn without_step(self) -> Self
Removes the step parameter.
Trait Implementations§
Source§impl AsHtmlConfig for RangeInputConfigs
impl AsHtmlConfig for RangeInputConfigs
Source§fn set_html_configs(&self, configs: HtmlElementConfig) -> HtmlElementConfig
fn set_html_configs(&self, configs: HtmlElementConfig) -> HtmlElementConfig
Sets the entitie’s properties as html attributes in the givenhtml configs object.
Auto Trait Implementations§
impl Freeze for RangeInputConfigs
impl RefUnwindSafe for RangeInputConfigs
impl Send for RangeInputConfigs
impl Sync for RangeInputConfigs
impl Unpin for RangeInputConfigs
impl UnwindSafe for RangeInputConfigs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more