pub struct Alert<T> { /* private fields */ }Expand description
A dialog / confirmation / action sheet. Buttons carry a typed payload T; .present()
awaits and returns the chosen button’s payload, or None on cancel/dismiss.
ⓘ
let choice = Alert::new(tr("delete-title"))
.message(tr("delete-body"))
.destructive(tr("delete"), Choice::Delete)
.cancel(tr("cancel"))
.present().await; // Option<Choice>Implementations§
Source§impl<T> Alert<T>
impl<T> Alert<T>
pub fn new<M>(title: impl IntoText<M>) -> Alert<T>
pub fn message<M>(self, m: impl IntoText<M>) -> Self
Sourcepub fn sheet(self) -> Self
pub fn sheet(self) -> Self
Present as a bottom action sheet on mobile (desktop falls back to an alert).
A normal choice carrying value.
Sourcepub fn destructive<M>(self, label: impl IntoText<M>, value: T) -> Self
pub fn destructive<M>(self, label: impl IntoText<M>, value: T) -> Self
A destructive choice (red on Apple) carrying value.
Trait Implementations§
Source§impl<T: 'static> IntoFuture for Alert<T>
impl<T: 'static> IntoFuture for Alert<T>
Auto Trait Implementations§
impl<T> Freeze for Alert<T>
impl<T> RefUnwindSafe for Alert<T>where
T: RefUnwindSafe,
impl<T> Send for Alert<T>where
T: Send,
impl<T> Sync for Alert<T>where
T: Sync,
impl<T> Unpin for Alert<T>where
T: Unpin,
impl<T> UnsafeUnpin for Alert<T>
impl<T> UnwindSafe for Alert<T>where
T: UnwindSafe,
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
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>
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 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>
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