Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate failure;
- #[macro_use]
- extern crate failure_derive;
- use failure::Fallible;
- #[derive(Fail, Debug)]
- pub enum PlaybackErr {
- #[fail(display = "Player Instance error: {}", _0)]
- Instance(&'static str),
- #[fail(display = "Player Media error: {}", _0)]
- Media(&'static str),
- }
- pub fn test() -> Fallible<i32> {
- let value: Option<i32> = None;
- let r = value.ok_or(PlaybackErr::Media("Media out of sync."))?;
- Ok(r)
- }
- fn main() {
- let _n = test();
- }
Add Comment
Please, Sign In to add comment