#[macro_export]
macro_rules! node {
(
$(#[$meta:meta])*
source $name:ident<$T:ident: $crate::math::Transcendental, const $BUF:ident: usize>
$(where $($bounds:tt)*)?
{ $($tt:tt)* }
) => {
$crate::source_node! {
$(#[$meta])*
pub $name<$T, $BUF>
$(where $($bounds)*)?
{ $($tt)* }
}
};
(
$(#[$meta:meta])*
processor $name:ident<$T:ident: $crate::math::Transcendental, const $BUF:ident: usize>
$(where $($bounds:tt)*)?
{ $($tt:tt)* }
) => {
$crate::processor_node! {
$(#[$meta])*
pub $name<$T, $BUF>
$(where $($bounds)*)?
{ $($tt)* }
}
};
(
$(#[$meta:meta])*
sink $name:ident<$T:ident: $crate::math::Transcendental, const $BUF:ident: usize>
$(where $($bounds:tt)*)?
{ $($tt:tt)* }
) => {
$crate::sink_node! {
$(#[$meta])*
pub $name<$T, $BUF>
$(where $($bounds)*)?
{ $($tt)* }
}
};
}
#[macro_export]
macro_rules! with_parameters {
(
$node:expr,
$($name:ident: $value:expr),* $(,)?
) => {
{
let mut node = $node;
$(
let param_id = match $crate::ParameterId::new(stringify!($name)) {
Ok(id) => id,
Err(e) => panic!("Invalid parameter name '{}': {:?}", stringify!($name), e),
};
let param_value: $crate::ParamValue = $value.into();
match node.set_parameter(¶m_id, param_value) {
Ok(()) => {},
Err(e) => panic!("Failed to set parameter '{}': {:?}", stringify!($name), e),
}
)*
node
}
};
}