Struct ambient_api::prelude::CustomParseInput
source · pub struct CustomParseInput<T> {
pub value: T,
pub parse: Arc<CbDebuggable<dyn Fn(&str) -> Option<T> + Sync + Send>>,
pub to_string: Arc<CbDebuggable<dyn Fn(&T) -> String + Sync + Send>>,
pub on_change: Arc<CbDebuggable<dyn Fn(T) + Sync + Send>>,
}
Expand description
An editor for a value that can be parsed from a string, but with custom parsing and stringification.
Fields§
§value: T
The current value.
parse: Arc<CbDebuggable<dyn Fn(&str) -> Option<T> + Sync + Send>>
Callback for when the string needs to be parsed.
to_string: Arc<CbDebuggable<dyn Fn(&T) -> String + Sync + Send>>
Callback for when the value needs to be stringified.
on_change: Arc<CbDebuggable<dyn Fn(T) + Sync + Send>>
Callback for when the value changes.
Trait Implementations§
source§impl<T> Clone for CustomParseInput<T>where
T: Clone,
impl<T> Clone for CustomParseInput<T>where
T: Clone,
source§fn clone(&self) -> CustomParseInput<T>
fn clone(&self) -> CustomParseInput<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 CustomParseInput<T>where
T: Debug,
impl<T> Debug for CustomParseInput<T>where
T: Debug,
source§impl<T> ElementComponent for CustomParseInput<T>
impl<T> ElementComponent for CustomParseInput<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for CustomParseInput<T>
impl<T> Send for CustomParseInput<T>where
T: Send,
impl<T> Sync for CustomParseInput<T>where
T: Sync,
impl<T> Unpin for CustomParseInput<T>where
T: Unpin,
impl<T> !UnwindSafe for CustomParseInput<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.