Trait respo::dialog::PromptPluginInterface
source · pub trait PromptPluginInterface<T, U>where
T: Debug + Clone + RespoAction,
U: Fn(String, DispatchFn<T>) -> Result<(), String>,{
fn render(&self) -> Result<RespoNode<T>, String>
where
T: Clone + Debug;
fn show<V>(&self, dispatch: DispatchFn<T>, next_task: V) -> Result<(), String>
where
V: Fn(String) -> Result<(), String> + 'static;
fn close(&self, dispatch: DispatchFn<T>) -> Result<(), String>;
fn new(
states: StatesTree,
options: PromptOptions,
on_submit: U
) -> Result<Self, String>
where
Self: Sized;
fn share_with_ref(&self) -> Rc<Self>;
}
Expand description
provides the interfaces to component of prompt dialog
Required Methods§
sourcefn show<V>(&self, dispatch: DispatchFn<T>, next_task: V) -> Result<(), String>where
V: Fn(String) -> Result<(), String> + 'static,
fn show<V>(&self, dispatch: DispatchFn<T>, next_task: V) -> Result<(), String>where
V: Fn(String) -> Result<(), String> + 'static,
to show prompt dialog, second parameter is the callback task when the dialog is read, the callback is stored in a dirty to provide syntax sugar
sourcefn new(
states: StatesTree,
options: PromptOptions,
on_submit: U
) -> Result<Self, String>where
Self: Sized,
fn new(
states: StatesTree,
options: PromptOptions,
on_submit: U
) -> Result<Self, String>where
Self: Sized,
initialize the plugin, second parameter is the callback task when submitted,
shared it in Rc