Struct dipstick::core::ControlScopeFn [] [src]

pub struct ControlScopeFn<M> { /* fields omitted */ }

Returns a callback function to send commands to the metric scope. Writes can be performed by passing Some((&Metric, Value)) Flushes can be performed by passing None Used to write values to the scope or flush the scope buffer (if applicable). Simple applications may use only one scope. Complex applications may define a new scope fo each operation or request. Scopes can be moved acrossed threads (Send) but are not required to be thread-safe (Sync). Some implementations may be 'Sync', otherwise queue()ing or threadlocal() can be used.

Methods

impl<M> ControlScopeFn<M>
[src]

[src]

Create a new metric scope based on the provided scope function.

use dipstick::ControlScopeFn;
let ref mut scope: ControlScopeFn<String> = ControlScopeFn::new(|_cmd| { /* match cmd {} */  });

[src]

Write a value to this scope.

let ref mut scope = dipstick::to_log().open_scope(false);
scope.write(&"counter".to_string(), 6);

[src]

Flush this scope, if buffered.

let ref mut scope = dipstick::to_log().open_scope(true);
scope.flush();

[src]

If scope is buffered, controls whether to flush the scope one last time when it is dropped. The default is true.

let ref mut scope = dipstick::to_log().open_scope(true).flush_on_drop(false);

Trait Implementations

impl<M: Clone> Clone for ControlScopeFn<M>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<M> Sync for ControlScopeFn<M>
[src]

impl<M> Send for ControlScopeFn<M>
[src]

impl<M> Drop for ControlScopeFn<M>
[src]

[src]

Executes the destructor for this type. Read more