pub trait UserInterface: Send + Sync {
// Required methods
fn has_ui(&self) -> bool;
fn notify<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 str,
level: NotifyLevel,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn confirm<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
title: &'life1 str,
message: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn select_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
title: &'life1 str,
context: &'life2 str,
options: &'life3 [SelectOption],
) -> Pin<Box<dyn Future<Output = Option<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn input_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
title: &'life1 str,
context: &'life2 str,
placeholder: &'life3 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn set_status<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
text: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn set_widget<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
content: Option<WidgetContent>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn custom<'life0, 'async_trait>(
&'life0 self,
component: ComponentSpec,
) -> Pin<Box<dyn Future<Output = Option<Value>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn select<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
title: &'life1 str,
options: &'life2 [SelectOption],
) -> Pin<Box<dyn Future<Output = Option<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn multi_select_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
title: &'life1 str,
context: &'life2 str,
options: &'life3 [SelectOption],
) -> Pin<Box<dyn Future<Output = Option<Vec<usize>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn input<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
title: &'life1 str,
placeholder: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Abstraction over user interaction. Tools and extensions use this without knowing whether they’re in a TUI, headless, or print mode.
Required Methods§
Sourcefn notify<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 str,
level: NotifyLevel,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn notify<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 str,
level: NotifyLevel,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Non-blocking notification.
Sourcefn confirm<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
title: &'life1 str,
message: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn confirm<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
title: &'life1 str,
message: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Yes/no confirmation. Returns None if no UI or cancelled.
Sourcefn select_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
title: &'life1 str,
context: &'life2 str,
options: &'life3 [SelectOption],
) -> Pin<Box<dyn Future<Output = Option<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn select_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
title: &'life1 str,
context: &'life2 str,
options: &'life3 [SelectOption],
) -> Pin<Box<dyn Future<Output = Option<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Select from options with context. Returns None if no UI or cancelled.
Sourcefn input_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
title: &'life1 str,
context: &'life2 str,
placeholder: &'life3 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn input_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
title: &'life1 str,
context: &'life2 str,
placeholder: &'life3 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Text input with context. Returns None if no UI or cancelled.
Sourcefn set_status<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
text: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn set_status<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
text: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Persistent status in footer.
Sourcefn set_widget<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
content: Option<WidgetContent>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_widget<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
content: Option<WidgetContent>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Widget above/below editor.
Provided Methods§
Sourcefn select<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
title: &'life1 str,
options: &'life2 [SelectOption],
) -> Pin<Box<dyn Future<Output = Option<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn select<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
title: &'life1 str,
options: &'life2 [SelectOption],
) -> Pin<Box<dyn Future<Output = Option<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Select from options. Returns None if no UI or cancelled.
Sourcefn multi_select_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
title: &'life1 str,
context: &'life2 str,
options: &'life3 [SelectOption],
) -> Pin<Box<dyn Future<Output = Option<Vec<usize>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn multi_select_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
title: &'life1 str,
context: &'life2 str,
options: &'life3 [SelectOption],
) -> Pin<Box<dyn Future<Output = Option<Vec<usize>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Select multiple options. Returns None if no UI or cancelled.
Sourcefn input<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
title: &'life1 str,
placeholder: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn input<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
title: &'life1 str,
placeholder: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Text input. Returns None if no UI or cancelled.