From 9c79937485ae247b20a9e540e5c4bd87363b63f2 Mon Sep 17 00:00:00 2001 From: Jonas Olson Date: Thu, 6 Apr 2017 23:58:44 +0200 Subject: [PATCH] Allow for documentation strings in macro component_binop_impl. --- src/core/componentwise.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/componentwise.rs b/src/core/componentwise.rs index b839f959..e8fa857b 100644 --- a/src/core/componentwise.rs +++ b/src/core/componentwise.rs @@ -32,9 +32,9 @@ impl> Matrix { } macro_rules! component_binop_impl( - ($($binop: ident, $binop_mut: ident, $Trait: ident . $binop_assign: ident);* $(;)*) => {$( + ($($binop: ident, $binop_mut: ident, $Trait: ident . $binop_assign: ident, $desc:expr, $desc_mut:expr);* $(;)*) => {$( impl> Matrix { - /// Componentwise matrix multiplication. + #[doc = $desc] #[inline] pub fn $binop(&self, rhs: &Matrix) -> MatrixComponentOp where N: $Trait, @@ -54,7 +54,7 @@ macro_rules! component_binop_impl( } impl> Matrix { - /// Componentwise matrix multiplication. + #[doc = $desc_mut] #[inline] pub fn $binop_mut(&mut self, rhs: &Matrix) where N: $Trait, @@ -71,7 +71,9 @@ macro_rules! component_binop_impl( ); component_binop_impl!( - component_mul, component_mul_mut, ClosedMul.mul_assign; - component_div, component_div_mut, ClosedDiv.div_assign; + component_mul, component_mul_mut, ClosedMul.mul_assign, + "Componentwise matrix multiplication.", "Mutable, componentwise matrix multiplication."; + component_div, component_div_mut, ClosedDiv.div_assign, + "Componentwise matrix division.", "Mutable, componentwise matrix division."; // FIXME: add other operators like bitshift, etc. ? );