[][src]Struct influent::measurement::Measurement

pub struct Measurement<'a> {
    pub key: &'a str,
    pub timestamp: Option<i64>,
    pub fields: BTreeMap<Cow<'a, str>, Value<'a>>,
    pub tags: BTreeMap<Cow<'a, str>, Cow<'a, str>>,
}

Measurement model.

Fields

key: &'a str

Key.

timestamp: Option<i64>

Timestamp.

fields: BTreeMap<Cow<'a, str>, Value<'a>>

Map of fields.

tags: BTreeMap<Cow<'a, str>, Cow<'a, str>>

Map of tags.

Methods

impl<'a> Measurement<'a>[src]

pub fn new(key: &str) -> Measurement[src]

Constructs a new Measurement.

Examples

use influent::measurement::Measurement;

let measurement = Measurement::new("key");

pub fn add_field<T>(&mut self, field: T, value: Value<'a>) where
    T: Into<Cow<'a, str>>, 
[src]

Adds field to the measurement.

Examples

use influent::measurement::{Measurement, Value};

let mut measurement = Measurement::new("key");

measurement.add_field("field", Value::String("hello"));

pub fn add_tag<I, K>(&mut self, tag: I, value: K) where
    I: Into<Cow<'a, str>>,
    K: Into<Cow<'a, str>>, 
[src]

Adds tag to the measurement.

Examples

use influent::measurement::{Measurement, Value};

let mut measurement = Measurement::new("key");

measurement.add_tag("tag", "value");

pub fn set_timestamp(&mut self, timestamp: i64)[src]

Sets the timestamp of the measurement. It should be unix timestamp in nanosecond

Examples

use influent::measurement::{Measurement, Value};

let mut measurement = Measurement::new("key");

measurement.set_timestamp(1434055562000000000)

Trait Implementations

impl<'a> Debug for Measurement<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Measurement<'a>

impl<'a> Send for Measurement<'a>

impl<'a> Sync for Measurement<'a>

impl<'a> Unpin for Measurement<'a>

impl<'a> UnwindSafe for Measurement<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.