mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
separate render/content macros; add has_jack
This commit is contained in:
parent
08184f9906
commit
e62e36d558
19 changed files with 183 additions and 226 deletions
|
|
@ -1,13 +0,0 @@
|
|||
use crate::*;
|
||||
|
||||
/// Implement [TryFrom<&Arc<RwLock<JackConnection>>>]: create app state from wrapped JACK handle.
|
||||
#[macro_export] macro_rules! from_jack {
|
||||
(|$jack:ident|$Struct:ident$(<$($L:lifetime),*$($T:ident$(:$U:path)?),*>)? $cb:expr) => {
|
||||
impl $(<$($L),*$($T $(: $U)?),*>)? TryFrom<&Arc<RwLock<JackConnection>>> for $Struct $(<$($L),*$($T),*>)? {
|
||||
type Error = Box<dyn std::error::Error>;
|
||||
fn try_from ($jack: &Arc<RwLock<JackConnection>>) -> Usually<Self> {
|
||||
Ok($cb)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -3,3 +3,22 @@ use crate::*;
|
|||
pub trait HasJack {
|
||||
fn jack (&self) -> &Arc<RwLock<JackConnection>>;
|
||||
}
|
||||
|
||||
/// Implement [HasJack].
|
||||
#[macro_export] macro_rules! has_jack {
|
||||
(|$self:ident:$Struct:ident$(<$($L:lifetime),*$($T:ident$(:$U:path)?),*>)?|$cb:expr) => {
|
||||
impl $(<$($L),*$($T $(: $U)?),*>)? HasJack for $Struct $(<$($L),*$($T),*>)? {
|
||||
fn jack (&$self) -> &Arc<RwLock<JackConnection>> { $cb }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Implement [TryFrom<&Arc<RwLock<JackConnection>>>]: create app state from wrapped JACK handle.
|
||||
#[macro_export] macro_rules! from_jack {
|
||||
(|$jack:ident|$Struct:ident$(<$($L:lifetime),*$($T:ident$(:$U:path)?),*>)? $cb:expr) => {
|
||||
impl $(<$($L),*$($T $(: $U)?),*>)? TryFrom<&Arc<RwLock<JackConnection>>> for $Struct $(<$($L),*$($T),*>)? {
|
||||
type Error = Box<dyn std::error::Error>;
|
||||
fn try_from ($jack: &Arc<RwLock<JackConnection>>) -> Usually<Self> { Ok($cb) }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ pub(crate) use ::jack::{
|
|||
Unowned, MidiIn, MidiOut, AudioIn, AudioOut,
|
||||
};
|
||||
|
||||
mod from_jack; pub use self::from_jack::*;
|
||||
mod has_jack; pub use self::has_jack::*;
|
||||
mod jack_audio; pub use self::jack_audio::*;
|
||||
mod jack_connect; pub use self::jack_connect::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue