pub struct Observe<'a> { /* private fields */ }Implementations§
Source§impl Observe<'_>
impl Observe<'_>
Sourcepub fn metric(&mut self, name: &str, value: f64) -> bool
pub fn metric(&mut self, name: &str, value: f64) -> bool
Examples found in repository?
examples/example_smoke.rs (line 14)
5fn main() {
6 let tests = collect_tests(|| {
7 describe!("math", {
8 test!("adds two numbers", |ctx| {
9 ctx.stdout("ok\n");
10 expect(2 + 3).to_be(5);
11 });
12
13 test!("handles negatives", id = "math/handles-negatives", |ctx| {
14 assert!(ctx.observe().metric("wall_time_ns", 42.0));
15 expect(-2 + 1).to_be(-1);
16 });
17 });
18 })
19 .expect("collection should validate");
20
21 for test in &tests {
22 let outcome = run_test(test);
23 println!("{} => {}", test.canonical_name(), outcome.exit);
24 }
25}pub fn vector(&mut self, name: &str, values: &[f64]) -> bool
pub fn tag(&mut self, name: &str, value: &str) -> bool
Auto Trait Implementations§
impl<'a> Freeze for Observe<'a>
impl<'a> RefUnwindSafe for Observe<'a>
impl<'a> Send for Observe<'a>
impl<'a> Sync for Observe<'a>
impl<'a> Unpin for Observe<'a>
impl<'a> UnsafeUnpin for Observe<'a>
impl<'a> !UnwindSafe for Observe<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more