Created
January 27, 2015 04:35
-
-
Save shadowmint/923ed7a5c21da552386f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
enum PlayerError { | |
InvalidCodec(String), | |
InvalidMedia, | |
} | |
impl std::fmt::Display for PlayerError { | |
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { | |
use self::PlayerError::*; | |
let s = match *self { | |
InvalidCodec(ref s) => format!("Invalid codec: {}", s).clone(), | |
InvalidMedia => String::from_str("Unable to decode media"), | |
}; | |
std::fmt::Display::fmt(s.as_slice(), f) | |
} | |
} | |
fn main() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment