[−][src]Crate twitter_stream
Twitter Stream
A library for listening on Twitter Streaming API.
Usage
Add twitter-stream to your dependencies in your project's Cargo.toml:
[dependencies]
twitter-stream = "0.9"
and this to your crate root:
extern crate twitter_stream;
Overview
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}; let token = Token::new("consumer_key", "consumer_secret", "access_key", "access_secret"); let future = TwitterStreamBuilder::filter(token) .track(Some("@Twitter")) .listen() .unwrap() .flatten_stream() .for_each(|json| { println!("{}", json); Ok(()) }) .map_err(|e| println!("error: {}", e)); rt::run(future);
Re-exports
pub use error::Error; |
Modules
| error | Error types |
| rt | Some reexports from |
| types | Common types used across the crate. |
Structs
| FutureTwitterStream | A future returned by constructor methods
which resolves to a |
| Token | An OAuth token used to log into Twitter. |
| TwitterStream | A listener for Twitter Streaming API. It yields JSON strings returned from the API. |
| TwitterStreamBuilder | A builder for |