Struct ambient_ui::prompt::Prompt
source · pub struct Prompt {
pub title: String,
pub placeholder: Option<String>,
pub on_ok: Cb<dyn Fn(&mut World, String) + Sync + Send>,
pub on_cancel: Option<Cb<dyn Fn(&mut World) + Sync + Send>>,
}
Expand description
A full-screen prompt dialog that the user must acknowledge.
Fields§
§title: String
The title of the prompt.
placeholder: Option<String>
The placeholder text to display in the text editor.
on_ok: Cb<dyn Fn(&mut World, String) + 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 Prompt
impl Prompt
sourcepub fn new(
title: impl Into<String>,
set_screen: Cb<dyn Fn(Option<Element>) + Sync + Send>,
on_ok: impl Fn(&mut World, String) + Sync + Send + 'static
) -> Self
pub fn new( title: impl Into<String>, set_screen: Cb<dyn Fn(Option<Element>) + Sync + Send>, on_ok: impl Fn(&mut World, String) + Sync + Send + 'static ) -> Self
Creates a new Prompt
with the given title and callback.
sourcepub fn new_cancelable(
title: impl Into<String>,
set_screen: Cb<dyn Fn(Option<Element>) + Sync + Send>,
on_ok: impl Fn(&mut World, String) + Sync + Send + 'static
) -> Self
pub fn new_cancelable( title: impl Into<String>, set_screen: Cb<dyn Fn(Option<Element>) + Sync + Send>, on_ok: impl Fn(&mut World, String) + Sync + Send + 'static ) -> Self
Creates a new Prompt
with the given title and callback, and a “Cancel” button that exits the prompt.
sourcepub fn placeholder(self, placeholder: impl Into<String>) -> Self
pub fn placeholder(self, placeholder: impl Into<String>) -> Self
Sets the placeholder text to display in the text editor.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Prompt
impl Send for Prompt
impl Sync for Prompt
impl Unpin for Prompt
impl !UnwindSafe for Prompt
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.