Skip to content

Instantly share code, notes, and snippets.

@olsonjeffery
Created August 2, 2013 13:15
Show Gist options
  • Save olsonjeffery/6139793 to your computer and use it in GitHub Desktop.
Save olsonjeffery/6139793 to your computer and use it in GitHub Desktop.
use std::io::println;
use std::result::{Result, Ok};
use std::task::{spawn};
pub struct Foo(int);
pub trait Bar {
fn baz(&self);
}
impl Bar for Foo {
pub fn baz(&self) { println("yay me?"); }
}
pub struct Froobie(~Bar);
fn main() {
println("hello world");
let v = 1;
do spawn {
let foo = Foo(1);
let r: Result<~Bar, ()> = Ok(foo as ~Bar);
let froobie = match r {
Ok(f) => Froobie(~f),
Err(_) => {}
};
(*froobie).baz();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment