Struct rinfluxdb_lineprotocol::LineBuilder [−][src]
pub struct LineBuilder { /* fields omitted */ }
Expand description
Build a record
Implementations
Create a new line for a measurement
let line = LineBuilder::new("measurement")
.build();
assert_eq!(line.measurement(), &"measurement".into());
Insert a field in the line
let line = LineBuilder::new("measurement")
.insert_field("latitude", 55.383333)
.insert_field("longitude", 10.383333)
.build();
assert_eq!(line.field("latitude"), Some(&55.383333.into()));
assert_eq!(line.field("longitude"), Some(&10.383333.into()));
Insert a tag in the line
let line = LineBuilder::new("measurement")
.insert_tag("city", "Odense")
.build();
assert_eq!(line.tag("city"), Some(&"Odense".into()));
Set the line timestamp
let line = LineBuilder::new("measurement")
.set_timestamp(Utc.ymd(2014, 7, 8).and_hms(9, 10, 11))
.build();
assert_eq!(line.timestamp(), Some(&Utc.ymd(2014, 7, 8).and_hms(9, 10, 11)));
Build the line
let line = LineBuilder::new("measurement")
.insert_field("latitude", 55.383333)
.insert_field("longitude", 10.383333)
.insert_tag("city", "Odense")
.set_timestamp(Utc.ymd(2014, 7, 8).and_hms(9, 10, 11))
.build();
assert_eq!(line.measurement(), &"measurement".into());
assert_eq!(line.field("latitude"), Some(&55.383333.into()));
assert_eq!(line.field("longitude"), Some(&10.383333.into()));
assert_eq!(line.tag("city"), Some(&"Odense".into()));
assert_eq!(line.timestamp(), Some(&Utc.ymd(2014, 7, 8).and_hms(9, 10, 11)));
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for LineBuilder
impl Send for LineBuilder
impl Sync for LineBuilder
impl Unpin for LineBuilder
impl UnwindSafe for LineBuilder
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more