diff --git a/src/influx.rs b/src/influx.rs index ab5ad3f..f095bfb 100644 --- a/src/influx.rs +++ b/src/influx.rs @@ -159,7 +159,7 @@ macro_rules! measure { meas }}; - ($m:tt, $name:tt, $( $t:tt ( $($tail:tt)* ) ),+ $(,)*) => { + ($m:expr, $name:tt, $( $t:tt ( $($tail:tt)* ) ),+ $(,)*) => { measure!($m, $name, $($t [ $($tail)* ] ),+) }; @@ -656,6 +656,23 @@ mod tests { assert_eq!(m.timestamp, Some(1)); } + #[test] + fn it_uses_measure_macro_on_a_self_attribute() { + struct A { + pub influx: InfluxWriter, + } + + impl A { + fn f(&self) { + measure!(self.influx, test, t(color, "red"), i(n, 1)); + } + } + + let a = A { influx: InfluxWriter::default() }; + + a.f(); + } + #[bench] fn influx_writer_send_basic(b: &mut Bencher) { let m = InfluxWriter::default();