Skip to main content

DashboardSection

Trait DashboardSection 

Source
pub trait DashboardSection: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn order(&self) -> i32;
    fn render(&self, ctx: &DashboardCtx) -> DashboardFragment;

    // Provided methods
    fn plugin_id(&self) -> Option<u64> { ... }
    fn default_enabled(&self) -> bool { ... }
}
Expand description

A contributor of one dashboard section.

The registry sorts by order (ties broken by id) for the default layout, and looks up by id when the user pins an explicit order via dashboard.sections.

Required Methods§

Source

fn id(&self) -> &str

Stable identifier, used in dashboard.sections and (CR.4) for plugin replace-by-id. Lowercase kebab, e.g. "getting-started".

Section ids are deliberately NOT namespaced by plugin, unlike help topics: replacing a builtin section is a stated capability, so a plugin registering getting-started is doing something supported.

Source

fn order(&self) -> i32

Default sort key for the built-in layout. Lower sorts first.

Source

fn render(&self, ctx: &DashboardCtx) -> DashboardFragment

Render this section’s contribution.

Provided Methods§

Source

fn plugin_id(&self) -> Option<u64>

CR.2: the host-issued plugin id that contributed this section, None for builtins. Provenance IS the teardown token — [DashboardRegistry::unregister_plugin] removes by it.

Defaulted, so no native section changes.

Source

fn default_enabled(&self) -> bool

Whether this section shows when the user has not customised dashboard.sections.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§