Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / playground.rs
Created February 24, 2017 08:11
Shared via Rust Playground
use std::error::Error;
use std::str::FromStr;
fn main() {
let s = "r5";
let x = i32::from_str(s).map_err(foo);
x.map_err(|v| println!("{}", v.description()));
}
fn foo<'a, A>(a: A) -> Box<Error + 'a>
anonymous
anonymous / playground.rs
Created February 23, 2017 23:46
Shared via Rust Playground
use std::error::Error;
fn main() {
println!("Hello, world!");
}
fn foo<'a, A>(a: A) -> Box<Error + 'a>
where A: Error + 'a
{
anonymous
anonymous / playground.rs
Created February 23, 2017 23:32
Shared via Rust Playground
use std::error::Error;
fn main() {
println!("Hello, world!");
}
fn foo<A>(a: A) -> Box<Error> where A: Error {
Box::new(a)
}