1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-02 11:11:04 +02:00

feat: ability to add custom modules instead native modules

Resolves #131
This commit is contained in:
Jake Stanger 2024-03-14 22:35:33 +00:00
parent 42ae915645
commit 994f4a4a12
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
21 changed files with 497 additions and 252 deletions

View file

@ -1,3 +1,31 @@
/// Provides implementations of methods required by the `Module` trait
/// which cannot be included as part of the trait.
///
/// This removes the need to add the same boilerplate method definitions
/// to every module implementation.
///
/// # Usage:
///
/// ```rs
/// impl Module for ClockModule {
/// type SendMessage = DateTime<Local>;
/// type ReceiveMessage = ();
///
/// module_impl!("clock");
/// }
#[macro_export]
macro_rules! module_impl {
($name:literal) => {
fn name() -> &'static str {
$name
}
fn take_common(&mut self) -> $crate::config::CommonConfig {
self.common.take().expect("common config to exist")
}
};
}
/// Sends a message on an asynchronous `Sender` using `send()`
/// Panics if the message cannot be sent.
///