Struct tk_carbon::Carbon [] [src]

pub struct Carbon { /* fields omitted */ }

A structure that is used to submit values to carbon

Internally it uses a state machine to communicate to the underlying network connection(s)

Methods

impl Carbon
[src]

[src]

This creates an instance of the Carbon public interface and Init structure that can be used to initialize a Proto instance

[src]

Add any numeric value for carbon with current timestamp

Example

Be careful when using this code, it's not being tested!
carbon.add_value("my.metric", 1);
carbon.add_value(
    format_args!("metrics.{host}.cpu", host),
    27);

Panics

  • When either name or value can't be formatted (Display'd)
  • When formatted name contains a whitespace or a newline

[src]

Add any numeric value for carbon with specific timestamp

Example

Be careful when using this code, it's not being tested!
let timestamp = SystemTime::now();
carbon.add_value_at("my.metric", 1, timestamp);
carbon.add_value_at(
    format_args!("metrics.{host}.cpu", host),
    27, timestamp);

Panics

  • When either name or value can't be formatted (Display'd)
  • When formatted name contains a whitespace or a newline
  • If timestamp is smaller than UNIX_EPOCH

Trait Implementations

impl Clone for Carbon
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Carbon
[src]

[src]

Formats the value using the given formatter.