Struct iced_web::widget::slider::Slider[][src]

pub struct Slider<'a, T, Message> { /* fields omitted */ }

An horizontal bar and a handle that selects a single value from a range of values.

A Slider will try to fill the horizontal space of its container.

The Slider range of numeric values is generic and its step size defaults to 1 unit.

Example

pub enum Message {
    SliderChanged(f32),
}

let state = &mut slider::State::new();
let value = 50.0;

Slider::new(state, 0.0..=100.0, value, Message::SliderChanged);

Slider drawn by Coffee’s renderer

Implementations

impl<'a, T, Message> Slider<'a, T, Message> where
    T: Copy + From<u8> + PartialOrd
[src]

pub fn new<F>(
    state: &'a mut State,
    range: RangeInclusive<T>,
    value: T,
    on_change: F
) -> Self where
    F: 'static + Fn(T) -> Message, 
[src]

Creates a new Slider.

It expects:

  • the local State of the Slider
  • an inclusive range of possible values
  • the current value of the Slider
  • a function that will be called when the Slider is dragged. It receives the new value of the Slider and must produce a Message.

pub fn width(self, width: Length) -> Self[src]

Sets the width of the Slider.

pub fn style(self, style: impl Into<Box<dyn StyleSheet>>) -> Self[src]

Sets the style of the Slider.

pub fn step(self, step: T) -> Self[src]

Sets the step size of the Slider.

Trait Implementations

impl<'a, T, Message> From<Slider<'a, T, Message>> for Element<'a, Message> where
    T: 'static + Copy + Into<f64> + FromPrimitive,
    Message: 'static, 
[src]

impl<'a, T, Message> Widget<Message> for Slider<'a, T, Message> where
    T: 'static + Copy + Into<f64> + FromPrimitive,
    Message: 'static, 
[src]

Auto Trait Implementations

impl<'a, T, Message> !RefUnwindSafe for Slider<'a, T, Message>

impl<'a, T, Message> !Send for Slider<'a, T, Message>

impl<'a, T, Message> !Sync for Slider<'a, T, Message>

impl<'a, T, Message> Unpin for Slider<'a, T, Message> where
    T: Unpin

impl<'a, T, Message> !UnwindSafe for Slider<'a, T, Message>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.