pub struct Selection<'a, T: Send + Sync + 'static> { /* private fields */ }Expand description
The selected items when the picker quits.
This is the return type of the various pick_multi* methods of a Picker.
Iterate over the picked items with iter. Also see the documentation for
multiple selections
The lifetime of this struct is bound to the lifetime of the picker from which it originated.
Implementations§
Source§impl<'a, T: Send + Sync + 'static> Selection<'a, T>
impl<'a, T: Send + Sync + 'static> Selection<'a, T>
Sourcepub fn iter(&self) -> impl ExactSizeIterator<Item = &'a T> + DoubleEndedIterator
pub fn iter(&self) -> impl ExactSizeIterator<Item = &'a T> + DoubleEndedIterator
Returns an iterator over the other selected items.
The iterator contains each selected item exactly once, sorted by index based on the order
in which the picker received the items. If multiple threads populate the picker, the
relative order between different threads is unspecified. Note that items are deduplicated
based on the selection index instead of using any properties of the type T itself.
See iter_selected_order to obtain the items in the order
selected by the user.
The iterator will be empty if the picker quit without selecting any items.
Sourcepub fn iter_selected_order(
&self,
) -> impl ExactSizeIterator<Item = &'a T> + DoubleEndedIterator
pub fn iter_selected_order( &self, ) -> impl ExactSizeIterator<Item = &'a T> + DoubleEndedIterator
Returns an iterator over the selected items, sorted by selection order.
The iterator contains each selected item exactly once. If an item is un-selected and selected again, the order is determined by the final selection.
Note that the current implementation does not internally store the selected items by selection order, so calling this method requires allocating a new container and then sorting.
The iterator will be empty if the picker quit without selecting any items.
Auto Trait Implementations§
impl<'a, T> Freeze for Selection<'a, T>
impl<'a, T> RefUnwindSafe for Selection<'a, T>
impl<'a, T> Send for Selection<'a, T>
impl<'a, T> Sync for Selection<'a, T>
impl<'a, T> Unpin for Selection<'a, T>
impl<'a, T> UnsafeUnpin for Selection<'a, T>
impl<'a, T> UnwindSafe for Selection<'a, T>
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> 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