pub struct SwipeAction { /* private fields */ }Expand description
One button in a row’s swipe-action offer (docs/list.md): what the platform reveals as the
user drags a row aside, built by swipe_action. Holds the label, the styling hints the
backend maps onto its own affordance, and the handler the activation runs.
Implementations§
Source§impl SwipeAction
impl SwipeAction
Sourcepub fn destructive(self) -> SwipeAction
pub fn destructive(self) -> SwipeAction
Mark the action destructive: the platform styles it as such (red, on the Apple toolkits) and may animate the row away on activation.
Sourcepub fn tint(self, color: Color) -> SwipeAction
pub fn tint(self, color: Color) -> SwipeAction
The button’s background color, where the platform honors one. Left unset, the platform picks its own default (gray, with red for destructive actions, on the Apple toolkits).
Sourcepub fn symbol(self, symbol: Symbol) -> SwipeAction
pub fn symbol(self, symbol: Symbol) -> SwipeAction
A glyph for the button where the platform draws one: above the label on macOS, in place of it on iOS (docs/list.md). The label still matters: it is the accessibility name, and the platforms without a glyph slot show it alone.
Sourcepub fn action(self, f: impl Fn() + 'static) -> SwipeAction
pub fn action(self, f: impl Fn() + 'static) -> SwipeAction
The work an activation runs. Called on the main thread at the next event drain, never inside the native gesture callback; the row index is the one the offer was pulled for, so capture what the action needs when building it.
Auto Trait Implementations§
impl !RefUnwindSafe for SwipeAction
impl !Send for SwipeAction
impl !Sync for SwipeAction
impl !UnwindSafe for SwipeAction
impl Freeze for SwipeAction
impl Unpin for SwipeAction
impl UnsafeUnpin for SwipeAction
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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