diff --git a/imgui/src/widget/slider.rs b/imgui/src/widget/slider.rs index 2b2604a..314eb76 100644 --- a/imgui/src/widget/slider.rs +++ b/imgui/src/widget/slider.rs @@ -48,6 +48,28 @@ impl<'a, T: DataTypeKind> Slider<'a, T> { } } /// Sets the range (inclusive) + /// + /// The argument uses the standard Rust [`std::ops::Range`] syntax. + /// + /// For example, to set both the min and max values: + /// + /// ```rust + /// # use imgui::im_str; + /// imgui::Slider::new(im_str!("Example")) + /// .range(1 ..= 10) + /// // Remember to call .build(&ui) + /// ; + /// ``` + /// + /// To set only the max value, using the default minimum value: + /// + /// ```rust + /// # use imgui::im_str; + /// imgui::Slider::new(im_str!("Example")) + /// .range(..= 10) + /// // Remember to call .build(&ui) + /// ; + /// ``` #[inline] pub fn range>(mut self, range: R) -> Self { self.min = range.start_bound().copied().unwrap_or(T::SLIDER_MIN);