Struct ambient_api::prelude::EditorPrompt
source · pub struct EditorPrompt<T>{
pub title: String,
pub value: T,
pub set_screen: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send>>,
pub on_ok: Arc<CbDebuggable<dyn Fn(&mut World, T) + Sync + Send>>,
pub on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send>>>,
pub validator: Option<Arc<CbDebuggable<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: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send>>
The callback to set the screen to None
.
on_ok: Arc<CbDebuggable<dyn Fn(&mut World, T) + Sync + Send>>
The callback to run when the user clicks “Ok”.
on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send>>>
The callback to run when the user clicks “Cancel”.
validator: Option<Arc<CbDebuggable<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> EditorPrompt<T>
impl<T> EditorPrompt<T>
sourcepub fn el(
title: String,
value: T,
set_screen: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send>>,
on_ok: Arc<CbDebuggable<dyn Fn(&mut World, T) + Sync + Send>>,
on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send>>>,
validator: Option<Arc<CbDebuggable<dyn Fn(&T) -> bool + Sync + Send>>>
) -> Element
pub fn el( title: String, value: T, set_screen: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send>>, on_ok: Arc<CbDebuggable<dyn Fn(&mut World, T) + Sync + Send>>, on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send>>>, validator: Option<Arc<CbDebuggable<dyn Fn(&T) -> bool + Sync + Send>>> ) -> Element
Create an Element
from this component.
source§impl<T> EditorPrompt<T>
impl<T> EditorPrompt<T>
Trait Implementations§
source§impl<T> Clone for EditorPrompt<T>
impl<T> 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 moresource§impl<T> Debug for EditorPrompt<T>
impl<T> Debug for EditorPrompt<T>
Auto 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.