pub trait RgbHooks: 'static {
// Provided methods
async fn on_rgb_init(
&mut self,
_driver: &mut impl RgbDriver,
_is_master: bool,
) { ... }
async fn on_rgb_process(
&mut self,
_driver: &mut impl RgbDriver,
_rgb_mode: &mut RgbMode,
) { ... }
async fn custom_rgb(
&mut self,
_driver: &mut impl RgbDriver,
_brightness: f32,
) { ... }
}
Expand description
Hooks related to RGB functionality.
This trait allows for custom RGB behavior to be implemented. These hooks are called in both master and slave sides of the keyboard.
Provided Methods§
Sourceasync fn on_rgb_init(&mut self, _driver: &mut impl RgbDriver, _is_master: bool)
async fn on_rgb_init(&mut self, _driver: &mut impl RgbDriver, _is_master: bool)
Invoked after the RGB driver is initialized.
_driver
:RgbDriver
instance to control RGB._is_master
: If true, this is the master side of the keyboard.
Sourceasync fn on_rgb_process(
&mut self,
_driver: &mut impl RgbDriver,
_rgb_mode: &mut RgbMode,
)
async fn on_rgb_process( &mut self, _driver: &mut impl RgbDriver, _rgb_mode: &mut RgbMode, )
Invoked
- after the
RgbCommand
is send and RGB task received it - before the RGB task processes the command.
You can use this hook to modify the RGB mode before the RGB task processes.
async fn custom_rgb(&mut self, _driver: &mut impl RgbDriver, _brightness: f32)
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.