Skip to content

Instantly share code, notes, and snippets.

#![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;
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);
@erickt
erickt / copy_type.rs
Created October 7, 2012 22:11 — forked from dbp/copy_type.rs
instantiating copy type warning
fn main() {
let x = (~"a",~"b");
match x {
(_, ref z) => io::println(z)
}
}
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; }
@erickt
erickt / hello.rc
Created April 19, 2012 14:47 — forked from zokier/hello.rc
rustc --test fails
#[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"];
We couldn’t find that file to show.