Skip to content

ashleygwilliams/changes-stream-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

changes-stream-rust

travis badge

an implementation of changes-stream in Rust.

this code reads in a readable stream from an endpoint and returns each chunk in JSON.

this code works off of the tokio branch of hyper to take advantage of new Rust Futures.

changes-stream-rust only works on nightly because it uses serde.

usage

in your Cargo.toml:

[dependencies]
changes-stream = { git = "https://github.com/ashleygwilliams/changes-stream-rust.git" }

from examples/follower.rs:

extern crate changes_stream;
extern crate futures;

use std::io;
use std::io::Write;

use changes_stream::ChangesStream;

fn main() {
    let url = "https://replicate.npmjs.com/_changes".to_string();
    let mut changes = ChangesStream::new(url);

    changes.on(|change| {
        io::stdout().write_all(&change).unwrap();
    });

    changes.run();
}

Releases

No releases published

Packages

No packages published

Languages