This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn run(conn: PooledConnection) -> Result<(), Box<Error>> { | |
let tweets = get_tweets()?; | |
let cells = tweets.into_iter() | |
.filter_map(|tweet| tweet.coordinates) | |
.filter_map(|(latitude, longitude)| { | |
let cell_result = Cell::find_containing_core(&*conn, &Point::new(longitude, latitude, Some(4326))).ok(); | |
cell_result.and_then(|cell| cell).map(|mut cell| { | |
cell.sns += 1; | |
cell | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::borrow::Cow; | |
use std::fmt::Debug; | |
use specs::Entity; | |
use Tile; | |
use TileRef; | |
use TileRefMut; | |
use TileMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub struct TileRefMut<'a, T: Tile + 'a> { | |
pub tile: &'a mut T, | |
pub x: usize, | |
pub y: usize | |
} | |
pub struct IterMut<'a, T: Tile + 'a> { | |
tile_map: &'a mut TileMap<T>, | |
x: usize, | |
y: usize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate cgmath; | |
extern crate specs; | |
#[macro_use] | |
extern crate gfx; | |
extern crate gfx_window_glutin; | |
extern crate glutin; | |
// Logging | |
#[macro_use] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for event in self.events.poll_iter() { | |
match event { | |
Event::Quit { .. } => self.running = false, | |
event => self.input.update(&self.events, event) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(prelude_import)] | |
#![no_std] | |
#![feature(plugin)] | |
#![plugin(slave_codegen)] | |
#[prelude_import] | |
use std::prelude::v1::*; | |
#[macro_use] | |
extern crate std as std; | |
extern crate slave; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![crate_type="dylib"] | |
#![feature(quote, plugin_registrar, rustc_private)] | |
extern crate slave; | |
extern crate proc_macro; | |
extern crate rustc_plugin; | |
extern crate syntax; | |
use rustc_plugin::Registry; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Worker)] | |
struct StatsWorker; | |
impl StatsWorker { | |
#![command] | |
fn write(&mut self) { | |
// Write some data to redis | |
} | |
#![command] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub mod container; | |
pub mod stack_view; | |
pub mod label; | |
pub use self::container::Container; | |
pub use self::stack_view::StackView; | |
pub use self::label::Label; | |
use ui::geom::*; | |
use ui::renderer::Renderer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::sync::{Arc, Mutex}; | |
use std::sync::mpsc::SyncSender; | |
use std::marker::PhantomData; | |
use iron::prelude::*; | |
use iron::{BeforeMiddleware, typemap, Request}; | |
use workers::MetricWriterCommand; |