pub struct Selector(/* private fields */);Expand description
Defines the values and ranges selected by a slider.
Selectors are set on the selector property.
Implementations§
Source§impl Selector
impl Selector
Sourcepub fn value<T>(selection: impl IntoVar<T>, min: T, max: T) -> Selectorwhere
T: SelectorValue,
pub fn value<T>(selection: impl IntoVar<T>, min: T, max: T) -> Selectorwhere
T: SelectorValue,
New with single value thumb of type T that can be set any value in the min..=max range.
Sourcepub fn value_with<T>(
selection: impl IntoVar<T>,
to_offset: impl Fn(&T) -> Factor + Send + Sync + 'static,
from_offset: impl Fn(Factor) -> T + Send + Sync + 'static,
) -> Selectorwhere
T: VarValue,
pub fn value_with<T>(
selection: impl IntoVar<T>,
to_offset: impl Fn(&T) -> Factor + Send + Sync + 'static,
from_offset: impl Fn(Factor) -> T + Send + Sync + 'static,
) -> Selectorwhere
T: VarValue,
New with a single value thumb of type T.
The value must convert to a normalized factor [0.fct()..=1.fct()] where 0.fct() is the minimum possible value and 1.fct() is the maximum
possible value. If a value outside of this range is returned it is clamped to the range and the selection variable is updated back.
Sourcepub fn many<T>(many: impl IntoVar<Vec<T>>, min: T, max: T) -> Selectorwhere
T: SelectorValue,
pub fn many<T>(many: impl IntoVar<Vec<T>>, min: T, max: T) -> Selectorwhere
T: SelectorValue,
New with many value thumbs of type T that can be set any value in the min..=max range.
Sourcepub fn many_with<T>(
many: impl IntoVar<Vec<T>>,
to_offset: impl Fn(&T) -> Factor + Send + Sync + 'static,
from_offset: impl Fn(Factor) -> T + Send + Sync + 'static,
) -> Selectorwhere
T: VarValue,
pub fn many_with<T>(
many: impl IntoVar<Vec<T>>,
to_offset: impl Fn(&T) -> Factor + Send + Sync + 'static,
from_offset: impl Fn(Factor) -> T + Send + Sync + 'static,
) -> Selectorwhere
T: VarValue,
New with many value thumbs of type T.
The conversion closure have the same constraints as value_with.
Sourcepub fn to_offset<T>(&self, t: &T) -> Option<Factor>where
T: VarValue,
pub fn to_offset<T>(&self, t: &T) -> Option<Factor>where
T: VarValue,
Convert the value to a normalized factor.
If T is not the same type returns None.
Sourcepub fn from_offset<T>(&self, offset: impl IntoValue<Factor>) -> Option<T>where
T: VarValue,
pub fn from_offset<T>(&self, offset: impl IntoValue<Factor>) -> Option<T>where
T: VarValue,
Convert the normalized factor to a value T.
If T is not the same type returns None.
Sourcepub fn set(&self, from: impl IntoValue<Factor>, to: impl IntoValue<Factor>)
pub fn set(&self, from: impl IntoValue<Factor>, to: impl IntoValue<Factor>)
Move the thumb nearest to from to a new offset to.
Note that ranges don’t invert, this operation may swap the thumb roles.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Selector
impl !RefUnwindSafe for Selector
impl Send for Selector
impl Sync for Selector
impl Unpin for Selector
impl !UnwindSafe for Selector
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FsChangeNote for T
impl<T> FsChangeNote for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more