Skip to content

Instantly share code, notes, and snippets.

Created January 24, 2015 03:53
Show Gist options
  • Save anonymous/929aaf089ee55e7cd268 to your computer and use it in GitHub Desktop.
Save anonymous/929aaf089ee55e7cd268 to your computer and use it in GitHub Desktop.
use std::fmt;
use std::error::Error;
struct Foo;
impl Error for Foo {
fn description(&self) -> &str { "foo" }
}
impl fmt::Display for Foo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.description().fmt(f)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment