Skip to main content

SwipeAction

Struct SwipeAction 

Source
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

Source

pub fn destructive(self) -> Self

Mark the action destructive: the platform styles it as such (red, on the Apple toolkits) and may animate the row away on activation.

Source

pub fn tint(self, color: Color) -> Self

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).

Source

pub fn symbol(self, symbol: Symbol) -> Self

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.

Source

pub fn action(self, f: impl Fn() + 'static) -> Self

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Day API ↩ Guides· daybrite.dev