pub struct ListDelete {
pub can_delete: Rc<dyn Fn(usize) -> bool>,
pub delete_row: Rc<dyn Fn(usize)>,
}Expand description
The synchronous swipe-to-delete half of ListSource (docs/list.md), shaped exactly like
ListReorder: both closures are called on the UI thread from inside native swipe callbacks,
outside any day-core borrow, and run to completion synchronously.
Each platform spells the gesture its own way (a trailing swipe action on iOS, an
ItemTouchHelper swipe on Android, a ListItem swipe action on ArkUI), but all three ask the
same two questions, so this struct is one pair of closures rather than three shapes.
Fields§
§can_delete: Rc<dyn Fn(usize) -> bool>May row index be deleted? Called before the affordance is offered, so a row the app
protects shows no delete action at all rather than one that fails on use.
delete_row: Rc<dyn Fn(usize)>Commit: delete row index. Removes it from Day’s row snapshot before returning (so
len/token_at/bind_row already reflect the shorter list while the native row-removal
animates) and defers the app’s own callback to the next event drain.
Trait Implementations§
Source§impl Clone for ListDelete
impl Clone for ListDelete
Source§fn clone(&self) -> ListDelete
fn clone(&self) -> ListDelete
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more