3 releases

Uses old Rust 2015

0.1.2 Nov 7, 2018
0.1.1 Mar 3, 2018
0.1.0 Mar 3, 2018

#13 in #timeseries

Download history 2/week @ 2023-11-02 2/week @ 2023-11-09 5/week @ 2023-11-16 3/week @ 2023-11-23 14/week @ 2023-11-30 3/week @ 2023-12-14 6/week @ 2023-12-21 1/week @ 2024-01-11 5/week @ 2024-01-18 7/week @ 2024-01-25 6/week @ 2024-02-01 8/week @ 2024-02-08 46/week @ 2024-02-15

67 downloads per month

MIT license

9KB
169 lines

asink

Crate docs.rs Build Status

Asynchorous sink wrapper for time-series data


lib.rs:

Async sink of time-series data based on serde-rs

Example

extern crate asink;
extern crate serde;
#[macro_use]
extern crate serde_derive;

use asink::*;
use std::sync::mpsc::Sender;

/// This will be serialized into msgpack
#[derive(Serialize)]
struct Doc {
    id: usize,
    data: Vec<f64>,
}

fn experiment(s: Sender<Doc>) {
    for i in 0..5 {
        let doc = Doc {
            id: i,
            data: vec![i as f64],
        };
        s.send(doc).unwrap(); // Send data to sink
    }
}

fn main() {
    let sink = msgpack::MsgpackSink::from_str("test.msg");
    let (s, th) = sink.run(); // Sink start thread to write recieved data into msgpack
    experiment(s);
    th.join().unwrap();
}

Dependencies

~13MB
~258K SLoC