docs: add doc comments to macros

This commit is contained in:
🪞👃🪞 2024-07-06 20:37:17 +03:00
parent c5369328f4
commit 828436745c
7 changed files with 9 additions and 0 deletions

View file

@ -10,6 +10,7 @@ pub trait Handle {
}
}
/// Implement the `Handle` trait.
#[macro_export] macro_rules! handle {
($T:ty) => {
impl Handle for $T {}
@ -70,12 +71,14 @@ pub fn handle_keymap <T> (
Ok(false)
}
/// Define a key binding.
#[macro_export] macro_rules! key {
($k:ident $(($char:literal))?, $m:ident, $n: literal, $d: literal, $f: expr) => {
(KeyCode::$k $(($char))?, KeyModifiers::$m, $n, $d, &$f)
};
}
/// Define a keymap.
#[macro_export] macro_rules! keymap {
($T:ty { $([$k:ident $(($char:literal))?, $m:ident, $n: literal, $d: literal, $f: expr]),* $(,)? }) => {
&[

View file

@ -24,6 +24,7 @@ pub trait Render: Send {
}
}
/// Implement the `Render` trait.
#[macro_export] macro_rules! render {
($T:ty) => {
impl Render for $T {}

View file

@ -51,6 +51,7 @@ pub trait Ports {
}
}
/// Implement the `Ports` trait.
#[macro_export] macro_rules! ports {
($T:ty $({ $(audio: {
$(ins: |$ai_arg:ident|$ai_impl:expr,)?

View file

@ -19,6 +19,7 @@ pub mod jack;
use crate::{core::*, model::*};
/// Application entrypoint.
pub fn main () -> Usually<()> {
let mut app = App::default();

View file

@ -1,5 +1,6 @@
use crate::core::*;
/// Define a MIDI phrase.
#[macro_export] macro_rules! phrase {
($($t:expr => $msg:expr),* $(,)?) => {{
let mut phrase = BTreeMap::new();

View file

@ -109,6 +109,7 @@ impl Sampler {
}
}
/// Load sample from WAV and assign to MIDI note.
#[macro_export] macro_rules! sample {
($note:expr, $name:expr, $src:expr) => {
{

View file

@ -17,6 +17,7 @@ use crate::{render, App, core::*};
render!(App |self, buf, area| {
let Rect { x, mut y, width, height } = area;
return Ok(area);
y = y + TransportView {
timebase: &self.timebase,