pub struct Slider {
pub id: Option<NodeId>,
pub value: f32,
pub min: f32,
pub max: f32,
pub on_change: Option<ActionEnvelope>,
}Expand description
A continuous value selector rendered as a horizontal track with a draggable thumb.
The thumb position is determined by value within the [min, max] range.
Dragging dispatches the on_change action with the new value carried as
pointer input (see [ActionInput::as_pointer]).
§Example
ⓘ
Slider {
value: view.state.volume,
min: 0.0,
max: 1.0,
on_change: Some(ctx.bind(
VolumeChanged,
handle_volume as fn(&mut S, VolumeChanged),
)),
..Default::default()
}Fields§
§id: Option<NodeId>Explicit node identity.
value: f32Current value (clamped to [min, max]).
min: f32Minimum value (default: 0.0).
max: f32Maximum value (default: 1.0).
on_change: Option<ActionEnvelope>Action dispatched when the user drags the thumb.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Slider
impl<'de> Deserialize<'de> for Slider
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Lower for Slider
impl Lower for Slider
Source§fn lower(&self, cx: &mut LoweringContext<'_>) -> NodeId
fn lower(&self, cx: &mut LoweringContext<'_>) -> NodeId
Lower this widget into the IR, returning the root node id.
Auto Trait Implementations§
impl Freeze for Slider
impl RefUnwindSafe for Slider
impl Send for Slider
impl Sync for Slider
impl Unpin for Slider
impl UnsafeUnpin for Slider
impl UnwindSafe for Slider
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.