31 lines
1.1 KiB
Rust
31 lines
1.1 KiB
Rust
// The utils module should provide utility functions that are used throughout the program.
|
|
// These functions could include functions to convert MIDI messages to and from human-readable formats, or to handle errors.
|
|
|
|
#[macro_export]
|
|
macro_rules! list_actions {
|
|
($proj:ident, $($id:literal, $action:ident),+ ) => {
|
|
{
|
|
let mut temp_vec:Vec<(u8, Box<(dyn Fn() + Send + 'static)>)> = Vec::new();
|
|
$(
|
|
let proj = Arc::clone(&$proj);
|
|
temp_vec.push((
|
|
$id,
|
|
Box::new(move || {
|
|
match proj.lock().unwrap().$action() {
|
|
Ok(_) => {}
|
|
Err(e) => {
|
|
println!(
|
|
"[ERROR] An error occurend while sending a ({}) message",
|
|
stringify!($action)
|
|
);
|
|
println!(" {}", e)
|
|
}
|
|
};
|
|
}),
|
|
));
|
|
)+
|
|
temp_vec
|
|
}
|
|
};
|
|
}
|