Struct ambient_ui::prompt::EditorPrompt
source · pub struct EditorPrompt<T: Editor + Debug + Clone + Sync + Send + 'static> {
pub title: String,
pub value: T,
pub set_screen: Cb<dyn Fn(Option<Element>) + Sync + Send>,
pub on_ok: Cb<dyn Fn(&mut World, T) + Sync + Send>,
pub on_cancel: Option<Cb<dyn Fn(&mut World) + Sync + Send>>,
pub validator: Option<Cb<dyn Fn(&T) -> bool + Sync + Send>>,
}
Expand description
A full-screen prompt dialog to edit a value.
Fields§
§title: String
The title of the prompt.
value: T
The initial value to edit.
set_screen: Cb<dyn Fn(Option<Element>) + Sync + Send>
The callback to set the screen to None
.
on_ok: Cb<dyn Fn(&mut World, T) + 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”.
validator: Option<Cb<dyn Fn(&T) -> bool + Sync + Send>>
The validator to run on the value. If the validator returns false
, the “Ok” button will be disabled.
Implementations§
source§impl<T: Editor + Debug + Clone + Sync + Send + 'static> EditorPrompt<T>
impl<T: Editor + Debug + Clone + Sync + Send + 'static> EditorPrompt<T>
sourcepub fn el(
title: String,
value: T,
set_screen: Cb<dyn Fn(Option<Element>) + Sync + Send>,
on_ok: Cb<dyn Fn(&mut World, T) + Sync + Send>,
on_cancel: Option<Cb<dyn Fn(&mut World) + Sync + Send>>,
validator: Option<Cb<dyn Fn(&T) -> bool + Sync + Send>>
) -> Element
pub fn el( title: String, value: T, set_screen: Cb<dyn Fn(Option<Element>) + Sync + Send>, on_ok: Cb<dyn Fn(&mut World, T) + Sync + Send>, on_cancel: Option<Cb<dyn Fn(&mut World) + Sync + Send>>, validator: Option<Cb<dyn Fn(&T) -> bool + Sync + Send>> ) -> Element
Create an Element
from this component.
Trait Implementations§
source§impl<T: Clone + Editor + Debug + Clone + Sync + Send + 'static> Clone for EditorPrompt<T>
impl<T: Clone + Editor + Debug + Clone + Sync + Send + 'static> Clone for EditorPrompt<T>
source§fn clone(&self) -> EditorPrompt<T>
fn clone(&self) -> EditorPrompt<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<T> !RefUnwindSafe for EditorPrompt<T>
impl<T> Send for EditorPrompt<T>
impl<T> Sync for EditorPrompt<T>
impl<T> Unpin for EditorPrompt<T>where
T: Unpin,
impl<T> !UnwindSafe for EditorPrompt<T>
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.