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 + 'static,
from_offset: impl Fn(Factor) -> T + Send + 'static,
) -> Selectorwhere
T: VarValue,
pub fn value_with<T>(
selection: impl IntoVar<T>,
to_offset: impl Fn(&T) -> Factor + Send + 'static,
from_offset: impl Fn(Factor) -> T + Send + '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 range<T>(range: impl IntoVar<Range<T>>, min: T, max: T) -> Selectorwhere
T: SelectorValue,
pub fn range<T>(range: impl IntoVar<Range<T>>, min: T, max: T) -> Selectorwhere
T: SelectorValue,
New with two value thumbs of type T
that can be set any value in the min..=max
range.
sourcepub fn range_with<T>(
range: impl IntoVar<Range<T>>,
to_offset: impl Fn(&T) -> Factor + Send + 'static,
from_offset: impl Fn(Factor) -> T + Send + 'static,
) -> Selectorwhere
T: VarValue,
pub fn range_with<T>(
range: impl IntoVar<Range<T>>,
to_offset: impl Fn(&T) -> Factor + Send + 'static,
from_offset: impl Fn(Factor) -> T + Send + 'static,
) -> Selectorwhere
T: VarValue,
New with two values thumbs that define a range of type T
.
The conversion closure have the same constraints as value_with
.
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 + 'static,
from_offset: impl Fn(Factor) -> T + Send + 'static,
) -> Selectorwhere
T: VarValue,
pub fn many_with<T>(
many: impl IntoVar<Vec<T>>,
to_offset: impl Fn(&T) -> Factor + Send + 'static,
from_offset: impl Fn(Factor) -> T + Send + '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 thumbs(&self) -> Vec<ThumbValue>
pub fn thumbs(&self) -> Vec<ThumbValue>
Gets the value thumbs.
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 Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self
equals other
.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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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