Module fruently::forwardable::forward [] [src]

Send records as forward mode.

Usage

This trait is used as follows:

extern crate fruently;
extern crate time;
use fruently::fluent::Fluent;
use std::collections::HashMap;
use fruently::forwardable::Forwardable;
#[cfg(not(feature = "time-as-integer"))]
use fruently::event_time::EventTime;

// Using with Fluentd v0.14.
#[cfg(not(feature = "time-as-integer"))]
fn main() {
    let fruently = Fluent::new("127.0.0.1:24224", "test");
    let mut obj1: HashMap<String, String> = HashMap::new();
    obj1.insert("hey".to_string(), "Rust with forward mode!".to_string());
    let mut obj2: HashMap<String, String> = HashMap::new();
    obj2.insert("yeah".to_string(), "Also sent together!".to_string());
    let time = time::now();
    let entry = (EventTime::new(time), obj1);
    let entry2 = (EventTime::new(time), obj2);
    let _ = fruently.post(vec![(entry), (entry2)]);
}

// Using with Fluentd v0.12.
#[cfg(feature = "time-as-integer")]
fn main() {
    let fruently = Fluent::new("127.0.0.1:24224", "test");
    let mut obj1: HashMap<String, String> = HashMap::new();
    obj1.insert("hey".to_string(), "Rust with forward mode!".to_string());
    let mut obj2: HashMap<String, String> = HashMap::new();
    obj2.insert("yeah".to_string(), "Also sent together!".to_string());
    let time = time::now().to_timespec().sec;
    let entry = (time, obj1);
    let entry2 = (time, obj2);
    let _ = fruently.post(vec![(entry), (entry2)]);
}

Structs

Forward