pub trait PanelConfig: Debug {
// Required methods
fn parse(
name: &'static str,
table: &mut HashMap<String, Value>,
global: &Config,
) -> Result<Self>
where Self: Sized;
fn props(&self) -> (&'static str, bool);
fn run<'async_trait>(
self: Box<Self>,
cr: Rc<Context>,
global_attrs: Attrs,
height: i32,
) -> Pin<Box<dyn Future<Output = PanelRunResult> + 'async_trait>>
where Self: 'async_trait;
}
Expand description
The trait implemented by all panels. Provides support for parsing a panel
and turning it into a PanelStream
.
Required Methods§
Sourcefn parse(
name: &'static str,
table: &mut HashMap<String, Value>,
global: &Config,
) -> Result<Self>where
Self: Sized,
fn parse(
name: &'static str,
table: &mut HashMap<String, Value>,
global: &Config,
) -> Result<Self>where
Self: Sized,
Parses an instance of this type from a subset of the global Config
.
Sourcefn props(&self) -> (&'static str, bool)
fn props(&self) -> (&'static str, bool)
Returns the name of the panel. If the panel supports events, each instance must return a unique name.
Sourcefn run<'async_trait>(
self: Box<Self>,
cr: Rc<Context>,
global_attrs: Attrs,
height: i32,
) -> Pin<Box<dyn Future<Output = PanelRunResult> + 'async_trait>>where
Self: 'async_trait,
fn run<'async_trait>(
self: Box<Self>,
cr: Rc<Context>,
global_attrs: Attrs,
height: i32,
) -> Pin<Box<dyn Future<Output = PanelRunResult> + 'async_trait>>where
Self: 'async_trait,
Performs any necessary setup, then returns a PanelStream
representing the provided PanelConfig
.
§Errors
If the process of creating a PanelStream
fails.