Skip to content

Instantly share code, notes, and snippets.

@QuietMisdreavus
Created December 10, 2017 01:34
Show Gist options
  • Save QuietMisdreavus/52d6f2e2ad972d8a7e53f1cb98df9728 to your computer and use it in GitHub Desktop.
Save QuietMisdreavus/52d6f2e2ad972d8a7e53f1cb98df9728 to your computer and use it in GitHub Desktop.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
extern crate egg_mode;
mod common;
use common::tokio_core::reactor;
use common::futures::Stream;
use egg_mode::stream::{self, StreamMessage};
fn main() {
let mut core = reactor::Core::new().unwrap();
let c = common::Config::load(&mut core);
let handle = core.handle();
let stream = stream::user(&handle, &c.token);
core.run(stream.for_each(|msg| {
match msg {
StreamMessage::Tweet(tweet) => {
println!("");
common::print_tweet(&tweet);
}
//StreamMessage::Unknown(msg) => println!("{}", msg.pretty()),
_ => {}
}
Ok(())
})).unwrap();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment