Trait lazybar_core::PanelConfig
source · pub trait PanelConfig {
// 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(
self: Box<Self>,
cr: Rc<Context>,
global_attrs: Attrs,
height: i32,
) -> Result<(PanelStream, Option<ChannelEndpoint<Event, EventResponse>>)>;
}
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(
self: Box<Self>,
cr: Rc<Context>,
global_attrs: Attrs,
height: i32,
) -> Result<(PanelStream, Option<ChannelEndpoint<Event, EventResponse>>)>
fn run( self: Box<Self>, cr: Rc<Context>, global_attrs: Attrs, height: i32, ) -> Result<(PanelStream, Option<ChannelEndpoint<Event, EventResponse>>)>
Performs any necessary setup, then returns a PanelStream
representing the provided PanelConfig
.
§Errors
If the process of creating a PanelStream
fails.