Skip to main content

Module

Trait Module 

Source
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§

Source

fn name(&self) -> &str

Returns the name of the module

Source

fn should_display(&self, context: &Context, config: &dyn ModuleConfig) -> bool

Determines if this module should be displayed

Source

fn render(&self, context: &Context, config: &dyn ModuleConfig) -> String

Renders the module’s output as a string

Implementors§