Struct RangeInputConfigs

Source
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

Source

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    }
Source

pub fn with_max(self, max: f64) -> Self

Sets the new max parameter.

  • max : The new max parameter.
Source

pub fn with_min(self, min: f64) -> Self

Sets the new min parameter.

  • min : The new min parameter.
Source

pub fn with_step(self, step: f64) -> Self

Sets the step parameter.

  • step : The new step parameter.
Source

pub fn without_step(self) -> Self

Removes the step parameter.

Trait Implementations§

Source§

impl AsHtmlConfig for RangeInputConfigs

Source§

fn set_html_configs(&self, configs: HtmlElementConfig) -> HtmlElementConfig

Sets the entitie’s properties as html attributes in the givenhtml configs object.
Source§

impl Default for RangeInputConfigs

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.