Struct ambient_ui_native::Alert
source · pub struct Alert {
pub title: String,
pub set_screen: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send + 'static>>,
pub on_ok: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>,
pub on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>,
}
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: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send + 'static>>
The callback to set the screen to None
.
on_ok: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>
The callback to run when the user clicks “Ok”.
on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>
The callback to run when the user clicks “Cancel”.
Implementations§
source§impl Alert
impl Alert
sourcepub fn el(
title: String,
set_screen: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send + 'static>>,
on_ok: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>,
on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>
) -> Element
pub fn el( title: String, set_screen: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send + 'static>>, on_ok: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>, on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>> ) -> Element
Create an Element
from this component.
source§impl Alert
impl Alert
sourcepub fn new(
title: impl Into<String>,
set_screen: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send + 'static>>,
on_ok: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>,
on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>
) -> Alert
pub fn new( title: impl Into<String>, set_screen: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send + 'static>>, on_ok: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>, on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>> ) -> Alert
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> ComponentValueBase for Twhere
T: Send + Sync + 'static,
impl<T> ComponentValueBase for Twhere T: Send + Sync + 'static,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.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.