Struct ambient_ui_native::EditorPrompt
source · pub struct EditorPrompt<T>where
T: Editor + Debug + Clone + Sync + Send + 'static,{
pub title: String,
pub value: T,
pub set_screen: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send + 'static>>,
pub on_ok: Arc<CbDebuggable<dyn Fn(&mut World, T) + Sync + Send + 'static>>,
pub on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>,
pub validator: Option<Arc<CbDebuggable<dyn Fn(&T) -> bool + Sync + Send + 'static>>>,
}
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 + 'static>>
The callback to set the screen to None
.
on_ok: Arc<CbDebuggable<dyn Fn(&mut World, T) + 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”.
validator: Option<Arc<CbDebuggable<dyn Fn(&T) -> bool + Sync + Send + 'static>>>
The validator to run on the value. If the validator returns false
, the “Ok” button will be disabled.
Implementations§
source§impl<T> EditorPrompt<T>where
T: Editor + Debug + Clone + Sync + Send + 'static,
impl<T> EditorPrompt<T>where T: Editor + Debug + Clone + Sync + Send + 'static,
sourcepub fn el(
title: String,
value: T,
set_screen: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send + 'static>>,
on_ok: Arc<CbDebuggable<dyn Fn(&mut World, T) + Sync + Send + 'static>>,
on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>,
validator: Option<Arc<CbDebuggable<dyn Fn(&T) -> bool + Sync + Send + 'static>>>
) -> Element
pub fn el( title: String, value: T, set_screen: Arc<CbDebuggable<dyn Fn(Option<Element>) + Sync + Send + 'static>>, on_ok: Arc<CbDebuggable<dyn Fn(&mut World, T) + Sync + Send + 'static>>, on_cancel: Option<Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>>, validator: Option<Arc<CbDebuggable<dyn Fn(&T) -> bool + Sync + Send + 'static>>> ) -> Element
Create an Element
from this component.
Trait Implementations§
source§impl<T> Clone for EditorPrompt<T>where
T: Clone + Editor + Debug + Sync + Send + 'static,
impl<T> Clone for EditorPrompt<T>where T: Clone + Editor + Debug + Sync + Send + 'static,
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> 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.