xacli_core/application/
component.rs

1use crate::{Context, InputValue, Result};
2
3pub struct ComponentInfo {
4    pub name: String,
5    pub title: String,
6    pub description: String,
7}
8
9/// Interactive component that produces output
10pub trait OutputComponent {
11    /// Get component information
12    fn info(&self) -> ComponentInfo;
13
14    /// Run the component, handling rendering and events internally
15    fn run(&mut self, ctx: &mut dyn Context) -> Result<()>;
16}
17
18/// Interactive component that runs with a context
19pub trait InputComponent {
20    /// Get component information
21    fn info(&self) -> ComponentInfo;
22
23    /// Run the component, handling rendering and events internally
24    fn run(&mut self, ctx: &mut dyn Context) -> Result<InputValue>;
25}