macro_rules! impl_node {
(
mod $mod_name:ident {
$($rest:tt)*
}
) => { ... };
(@normalize
mod $mod_name:ident {
{}
{ $( $extra_code:tt )* }
[ $( $node_inputs:tt )* ]
[ $( $node_parameters:tt )* ]
[ $( $node_outputs:tt )* ]
[ $( $node_struct_fields:tt )* ]
{ $( $node_struct:tt )* }
{ $( $node_impl:tt )* }
{ $( $node_trait_impl:tt )* }
NodeInfo {
$($node_info:tt)*
}
$($rest:tt)*
}
) => { ... };
(@normalize
mod $mod_name:ident {
{ $( $node_info:tt )* }
{ $( $extra_code:tt )* }
[ $( $node_inputs:tt )* ]
[ $( $node_parameters:tt )* ]
[ $( $node_outputs:tt )* ]
[ $( $node_struct_fields:tt )* ]
{ $( $node_struct:tt )* }
{ $( $node_impl:tt )* }
{ $( $node_trait_impl:tt )* }
$(#[$param_enum_meta:meta])*
pub enum $param_enum_name:ident {
$($param_enum_fields:tt)*
}
$($rest:tt)*
}
) => { ... };
(@normalize
mod $mod_name:ident {
{ $( $node_info:tt )* }
{ $( $extra_code:tt )* }
[ $( $node_inputs:tt )* ]
[ $( $node_parameters:tt )* ]
[ $( $node_outputs:tt )* ]
[]
{}
{ $( $node_impl:tt )* }
{ $( $node_trait_impl:tt )* }
$(#[$node_struct_attr:meta])*
pub struct $node_ty_name:ident {
$($unparsed_fields:tt)*
}
$($rest:tt)*
}
) => { ... };
(@normalize_fields
mod $mod_name:ident {
{ $( $node_info:tt )* }
{ $( $extra_code:tt )* }
[ $( $node_inputs:tt )* ]
[ $( $node_parameters:tt )* ]
[ $( $node_outputs:tt )* ]
[ $( $node_struct_fields:tt )* ]
{ $( $node_struct:tt )* }
{ $( $node_impl:tt )* }
{ $( $node_trait_impl:tt )* }
___internal_parse_fields {
$( #[$field_meta:meta] )*
$field_vis:vis $field_name:ident : Input<$field_ty:ident> $(Color($color:literal))?,
$($unparsed_fields:tt)*
}
$($rest:tt)*
}
) => { ... };
(@normalize_fields
mod $mod_name:ident {
{ $( $node_info:tt )* }
{ $( $extra_code:tt )* }
[ $( $node_inputs:tt )* ]
[ $( $node_parameters:tt )* ]
[ $( $node_outputs:tt )* ]
[ $( $node_struct_fields:tt )* ]
{ $( $node_struct:tt )* }
{ $( $node_impl:tt )* }
{ $( $node_trait_impl:tt )* }
___internal_parse_fields {
$( #[$field_meta:meta] )*
$field_vis:vis $field_name:ident : Param<$field_ty:ident>,
$($unparsed_fields:tt)*
}
$($rest:tt)*
}
) => { ... };
(@normalize_fields
mod $mod_name:ident {
{ $( $node_info:tt )* }
{ $( $extra_code:tt )* }
[ $( $node_inputs:tt )* ]
[ $( $node_parameters:tt )* ]
[ $( $node_outputs:tt )* ]
[ $( $node_struct_fields:tt )* ]
{ $( $node_struct:tt )* }
{ $( $node_impl:tt )* }
{ $( $node_trait_impl:tt )* }
___internal_parse_fields {
$( #[$field_meta:meta] )*
$field_vis:vis $field_name:ident : Output<$field_ty:ident> $(Color($color:literal))?,
$($unparsed_fields:tt)*
}
$($rest:tt)*
}
) => { ... };
(@normalize_fields
mod $mod_name:ident {
{ $( $node_info:tt )* }
{ $( $extra_code:tt )* }
[ $( $node_inputs:tt )* ]
[ $( $node_parameters:tt )* ]
[ $( $node_outputs:tt )* ]
[ $( $node_struct_fields:tt )* ]
{ $( $node_struct:tt )* }
{ $( $node_impl:tt )* }
{ $( $node_trait_impl:tt )* }
___internal_parse_fields {
$( #[$field_meta:meta] )*
$field_vis:vis $field_name:ident : $field_ty:ident,
$($unparsed_fields:tt)*
}
$($rest:tt)*
}
) => { ... };
(@normalize_fields
mod $mod_name:ident {
{ $( $node_info:tt )* }
{ $( $extra_code:tt )* }
[ $( $node_inputs:tt )* ]
[ $( $node_parameters:tt )* ]
[ $( $node_outputs:tt )* ]
[ $( $node_struct_fields:tt )* ]
{ $( $node_struct:tt )* }
{ $( $node_impl:tt )* }
{ $( $node_trait_impl:tt )* }
___internal_parse_fields { }
$($rest:tt)*
}
) => { ... };
(@normalize
mod $mod_name:ident {
{ $( $node_info:tt )* }
{ $( $extra_code:tt )* }
[ $( $node_inputs:tt )* ]
[ $( $node_parameters:tt )* ]
[ $( $node_outputs:tt )* ]
[ $( $node_struct_fields:tt )* ]
{ $( $node_struct:tt )* }
{ $( $node_impl:tt )* }
{ $( $node_trait_impl:tt )* }
$(#[$node_impl_meta:meta])*
impl $node_ty_name:ident {
$( $ty_impl_fns:tt )*
}
$($rest:tt)*
}
) => { ... };
(@normalize
mod $mod_name:ident {
{ $( $node_info:tt )* }
{ $( $extra_code:tt )* }
[ $( $node_inputs:tt )* ]
[ $( $node_parameters:tt )* ]
[ $( $node_outputs:tt )* ]
[ $( $node_struct_fields:tt )* ]
{ $( $node_struct:tt )* }
{ $( $node_impl:tt )* }
{ $( $node_trait_impl:tt )* }
$(#[$node_impl_meta:meta])*
impl NodeImpl for $node_ty_name:ident {
$( $ty_node_impl_fns:tt )*
}
$($rest:tt)*
}
) => { ... };
(@normalize
mod $mod_name:ident {
{ $( $node_info:tt )* }
{ $( $extra_code:tt )* }
[ $( $node_inputs:tt )* ]
[ $( $node_parameters:tt )* ]
[ $( $node_outputs:tt )* ]
[ $( $node_struct_fields:tt )* ]
{ $( $node_struct:tt )* }
{ $( $node_impl:tt )* }
{ $( $node_trait_impl:tt )* }
$(#[$node_impl_meta:meta])*
impl $impl_trait_name:ident for $node_ty_name:ident {
$( $ty_impl_fns:tt )*
}
$($rest:tt)*
}
) => { ... };
(@normalize
mod $mod_name:ident {
{
name: $node_name:literal
$(
, description: $node_description:literal
)?
$(
, package: $node_package:expr
)?
$(
, category: $node_category:expr
)?
$(
, custom: {
$( $custom_field_name:ident: $custom_field_value:literal ),*
$(,)?
}
)?
$(,)?
}
{ $( $extra_code:tt )* }
[ $( $field_input_name:ident: $field_input_ty:ident $(Color($field_input_color:literal))?,)* ]
[ $( $field_param_name:ident: $field_param_ty:ident, )* ]
[ $( $field_output_name:ident: $field_output_ty:ident $(Color($field_output_color:literal))?, )* ]
[ $( $node_struct_fields:tt )* ]
{
$(#[$node_struct_attr:meta])*
pub struct $node_ty_name:ident;
}
{ $( $node_impl:tt )* }
{
$(#[$node_impl_meta:meta])*
impl NodeImpl for $node_impl_ty_name:ident {
$( $ty_node_impl_fns:tt )*
}
}
$($rest:tt)*
}
) => { ... };
}