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(plugin, custom_derive)] | |
#![plugin(serde_macros)] | |
extern crate serde; | |
extern crate serde_json; | |
use std::error::Error; | |
use serde::de::Error as SerdeError; | |
use serde_json::Value; |
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
fn process_files(files: Vec<File>, progress: Sender<uint>) { | |
let mut count = 0; | |
let mut it = files.iter().inspect(|_| count += 1).filter(|&f| test_file(f)).enumerate(); | |
loop { | |
let (i, f) = match it.next() { | |
None => break, | |
Some(x) => x | |
}; | |
if i % 100 == 0 { | |
progress.send(files.len() - count); |
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
fn main() { | |
let x = (~"a",~"b"); | |
match x { | |
(_, ref z) => io::println(z) | |
} | |
} |
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 io::ReaderUtil; | |
fn main() { | |
io::println("What is your favorite number?"); | |
fn read_favorite_number() -> int { | |
for io::stdin().each_line |line| { | |
match int::from_str(line) { | |
None => { io::println("That is not a number. :(\nTry again!"); } | |
Some(number) => { return number; } |
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
#[link( | |
name="rust_hello", | |
vers="0.1", | |
author = "zokier", | |
url="http://github.com/zokier/rust_hello", | |
uuid="6240d465-7dba-4aa8-9053-027a1b12ecc4" | |
)]; | |
#[desc = "Hello World"]; | |
#[comment = "Hello World"]; |