Module

Trait Module 

Source
pub trait Module {
    type Config: DeserializeOwned;

    // Required method
    fn init(info: &InitInfo, config: Self::Config) -> Self;

    // Provided methods
    fn update(&mut self) { ... }
    fn refresh(&mut self, signal: i32) { ... }
    fn do_action(&mut self, action: &str) { ... }
}
Expand description

A Waybar CFFI module.

In most cases, only Module::init needs to be specified, and the default implementations of the other methods can be used unchanged.

Required Associated Types§

Source

type Config: DeserializeOwned

The configuration type.

The JSONC configuration for the module will be deserialised using serde into a value of this type.

Required Methods§

Source

fn init(info: &InitInfo, config: Self::Config) -> Self

Called when the module is being initialised.

Generally, you’ll want to create your UI using gtk here, attaching it to the container returned by InitInfo::get_root_widget.

Provided Methods§

Source

fn update(&mut self)

Called when the module should be updated.

Source

fn refresh(&mut self, signal: i32)

Called when the module should be refreshed in response to a signal.

Source

fn do_action(&mut self, action: &str)

Called when an action is called on the module.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§