Struct ambient_ui::prompt::Alert
source · pub struct Alert {
pub title: String,
pub set_screen: Cb<dyn Fn(Option<Element>) + Sync + Send>,
pub on_ok: Option<Cb<dyn Fn(&mut World) + Sync + Send>>,
pub on_cancel: Option<Cb<dyn Fn(&mut World) + Sync + Send>>,
}
Expand description
A full-screen alert dialog that the user must acknowledge.
If neither on_ok
nor on_cancel
are specified, the user will not be able to dismiss the alert.
Fields§
§title: String
The title of the alert.
set_screen: Cb<dyn Fn(Option<Element>) + Sync + Send>
The callback to set the screen to None
.
on_ok: Option<Cb<dyn Fn(&mut World) + Sync + Send>>
The callback to run when the user clicks “Ok”.
on_cancel: Option<Cb<dyn Fn(&mut World) + Sync + Send>>
The callback to run when the user clicks “Cancel”.
Implementations§
source§impl Alert
impl Alert
sourcepub fn new(
title: impl Into<String>,
set_screen: Cb<dyn Fn(Option<Element>) + Sync + Send>,
on_ok: Option<Cb<dyn Fn(&mut World) + Sync + Send>>,
on_cancel: Option<Cb<dyn Fn(&mut World) + Sync + Send>>
) -> Self
pub fn new( title: impl Into<String>, set_screen: Cb<dyn Fn(Option<Element>) + Sync + Send>, on_ok: Option<Cb<dyn Fn(&mut World) + Sync + Send>>, on_cancel: Option<Cb<dyn Fn(&mut World) + Sync + Send>> ) -> Self
Creates a new Alert
. At least one of on_ok
or on_cancel
must be specified.
If on_ok
or on_cancel
are Some
, the respective button will exist.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Alert
impl Send for Alert
impl Sync for Alert
impl Unpin for Alert
impl !UnwindSafe for Alert
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> Downcast for T
impl<T> Downcast for T
source§impl<T> ElementComponentExt for Twhere
T: ElementComponent + 'static,
impl<T> ElementComponentExt for Twhere
T: ElementComponent + 'static,
source§impl<T> ElementComponentName for T
impl<T> ElementComponentName for T
source§fn element_component_name(&self) -> &'static str
fn element_component_name(&self) -> &'static str
Returns the name of the type implementing ElementComponent.