macro_rules! op {
(@count) => { ... };
(@count $head:tt $(, $tail:tt)*) => { ... };
(@maybe $x:expr) => { ... };
(@maybe) => { ... };
(@name $Op:ident, $name:literal) => { ... };
(@name $Op:ident) => { ... };
(@infix $v:expr) => { ... };
(@infix) => { ... };
(@commutative $v:expr) => { ... };
(@commutative) => { ... };
(@associative $v:expr) => { ... };
(@associative) => { ... };
(@complexity $v:expr) => { ... };
(@complexity) => { ... };
(
$(#[$meta:meta])*
$Op:ident for<$T:ident> { $($body:tt)* }
) => { ... };
(
$(#[$meta:meta])*
$vis:vis $Op:ident for<$T:ident> {
$(name: $name:literal,)?
$(display: $display:expr,)?
$(infix: $infix:expr,)?
$(aliases: [$($alias:expr),* $(,)?],)?
$(commutative: $commutative:expr,)?
$(associative: $associative:expr,)?
$(complexity: $complexity:expr,)?
eval: |[$($eval_arg:pat_param),+ $(,)?]| $eval_body:block,
partial: |[$($partial_arg:pat_param),+ $(,)?], $idx:pat_param| $partial_body:block $(,)?
}
) => { ... };
(
$(#[$meta:meta])*
$Op:ident for $t:ty { $($body:tt)* }
) => { ... };
(
$(#[$meta:meta])*
$vis:vis $Op:ident for $t:ty {
$(name: $name:literal,)?
$(display: $display:expr,)?
$(infix: $infix:expr,)?
$(aliases: [$($alias:expr),* $(,)?],)?
$(commutative: $commutative:expr,)?
$(associative: $associative:expr,)?
$(complexity: $complexity:expr,)?
eval: |[$($eval_arg:pat_param),+ $(,)?]| $eval_body:block,
partial: |[$($partial_arg:pat_param),+ $(,)?], $idx:pat_param| $partial_body:block $(,)?
}
) => { ... };
}Expand description
Define an operator marker type implementing crate::traits::Operator + crate::traits::OpTag.
This is the same DSL used for builtins in operator_enum::builtin, but exported so downstream
crates can define their own operators with identical syntax.