pub trait Module: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn should_display(
&self,
context: &Context,
config: &dyn ModuleConfig,
) -> bool;
fn render(&self, context: &Context, config: &dyn ModuleConfig) -> String;
}Expand description
Trait that all status line modules must implement
This is the core interface for creating status line components. Each module determines when to display itself and how to render its output based on the current context.
§Implementation Notes
- Modules should be stateless and thread-safe
- Heavy operations should be cached in Context
- Rendering should complete quickly to avoid timeouts
Required Methods§
Sourcefn should_display(&self, context: &Context, config: &dyn ModuleConfig) -> bool
fn should_display(&self, context: &Context, config: &dyn ModuleConfig) -> bool
Determines if this module should be displayed
Sourcefn render(&self, context: &Context, config: &dyn ModuleConfig) -> String
fn render(&self, context: &Context, config: &dyn ModuleConfig) -> String
Renders the module’s output as a string