pub struct ChoiceCore<T>{ /* private fields */ }Implementations§
Source§impl<T> ChoiceCore<T>
impl<T> ChoiceCore<T>
pub fn set_values(&mut self, values: Vec<T>)
Sourcepub fn set_default_value(&mut self, default_value: Option<T>)
pub fn set_default_value(&mut self, default_value: Option<T>)
Set a default-value other than T::default()
The starting value will still be T::default() after this. You must call clear() to use this default.
Sourcepub fn default_value(&self) -> &Option<T>
pub fn default_value(&self) -> &Option<T>
A default value.
Sourcepub fn selected(&self) -> Option<usize>
pub fn selected(&self) -> Option<usize>
Selected item index.
This may be None and there may still be a valid value. This can happen if a value is not in the value-list, or if the value-list is empty before the first render.
Use of value() is preferred.
Sourcepub fn set_selected(&mut self, select: usize) -> bool
pub fn set_selected(&mut self, select: usize) -> bool
Set the selected item by index.
If the select-idx doesn’t match the list of values, selected will be None. This may happen before the first render, while values is still empty.
Use of set_value() is preferred.
Sourcepub fn set_value(&mut self, value: T) -> bool
pub fn set_value(&mut self, value: T) -> bool
Set the value for this Choice.
The value will be retained even if it is not in the value-list. This can happen before the first render while the value-list is still empty. Or because a divergent value is set here.
The starting value will be T::default().
pub fn is_empty(&self) -> bool
pub fn clear(&mut self) -> bool
Trait Implementations§
Source§impl<T> Clone for ChoiceCore<T>
impl<T> Clone for ChoiceCore<T>
Source§fn clone(&self) -> ChoiceCore<T>
fn clone(&self) -> ChoiceCore<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T> Debug for ChoiceCore<T>
impl<T> Debug for ChoiceCore<T>
Auto Trait Implementations§
impl<T> Freeze for ChoiceCore<T>where
T: Freeze,
impl<T> RefUnwindSafe for ChoiceCore<T>where
T: RefUnwindSafe,
impl<T> Send for ChoiceCore<T>where
T: Send,
impl<T> Sync for ChoiceCore<T>where
T: Sync,
impl<T> Unpin for ChoiceCore<T>where
T: Unpin,
impl<T> UnwindSafe for ChoiceCore<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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