twitter-stream 0.8.0

A library for listening on Twitter Streaming API.
docs.rs failed to build twitter-stream-0.8.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: twitter-stream-0.13.0

Twitter Stream

Build Status Current Version Documentation

A Rust library for listening on Twitter Streaming API.

Requirements

This library requires Rust 1.26 or later.

Usage

Add this to your Cargo.toml:

[dependencies]
twitter-stream = "0.8"

and this to your crate root:

extern crate twitter_stream;

Here is a basic example that prints public mentions to @Twitter in JSON format:

extern crate twitter_stream;

use twitter_stream::{Token, TwitterStreamBuilder};
use twitter_stream::rt::{self, Future, Stream};

fn main() {
    let token = Token::new("consumer_key", "consumer_secret", "access_key", "access_secret");

    let future = TwitterStreamBuilder::filter(&token)
        .track(Some("@Twitter"))
        .listen()
        .flatten_stream()
        .for_each(|json| {
            println!("{}", json);
            Ok(())
        })
        .map_err(|e| println!("error: {}", e));

    rt::run(future);
}