pub struct SelectionExternalStorage<'f, Storage> { /* private fields */ }
Expand description
MultiSelectStorage that forwards the selection data to another place.
Storage
is the inner storage type, usually a mutable reference, but not
necessarily.
'f
is the lifetime of the setter function, usually 'static
.
Implementations§
Source§impl<'f, Storage> SelectionExternalStorage<'f, Storage>
impl<'f, Storage> SelectionExternalStorage<'f, Storage>
Sourcepub fn new(
storage: Storage,
selection_size: impl Fn(&Storage) -> Option<usize> + 'f,
setter: impl FnMut(&mut Storage, usize, bool) + 'f,
) -> Self
pub fn new( storage: Storage, selection_size: impl Fn(&Storage) -> Option<usize> + 'f, setter: impl FnMut(&mut Storage, usize, bool) + 'f, ) -> Self
Creates a new SelectionExternalStorage
.
The intended usage is that you keep the storage
in your code
and when multi-select happens, you pass a mutable reference to it in storage
,
along with a setter function to set the selection status of an item.
Additionally, pass a function to count the number of selected items. If you don’t
want to compute that, use |_| None
.
Sourcepub fn storage(&mut self) -> &mut Storage
pub fn storage(&mut self) -> &mut Storage
Gets a reference to the inner storage.
Sourcepub fn into_storage(self) -> Storage
pub fn into_storage(self) -> Storage
Unwraps the inner storage.
Trait Implementations§
Source§impl<'f, Storage> MultiSelectStorage for SelectionExternalStorage<'f, Storage>
impl<'f, Storage> MultiSelectStorage for SelectionExternalStorage<'f, Storage>
fn size(&self) -> Option<usize>
fn apply_requests(&mut self, ms: &mut MultiSelect)
Auto Trait Implementations§
impl<'f, Storage> Freeze for SelectionExternalStorage<'f, Storage>where
Storage: Freeze,
impl<'f, Storage> !RefUnwindSafe for SelectionExternalStorage<'f, Storage>
impl<'f, Storage> !Send for SelectionExternalStorage<'f, Storage>
impl<'f, Storage> !Sync for SelectionExternalStorage<'f, Storage>
impl<'f, Storage> Unpin for SelectionExternalStorage<'f, Storage>where
Storage: Unpin,
impl<'f, Storage> !UnwindSafe for SelectionExternalStorage<'f, Storage>
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
Mutably borrows from an owned value. Read more