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:
parent
42ae915645
commit
994f4a4a12
21 changed files with 497 additions and 252 deletions
|
@ -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.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue