Guest User

Untitled

a guest
Oct 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. extern crate failure;
  2. #[macro_use]
  3. extern crate failure_derive;
  4.  
  5. use failure::Fallible;
  6.  
  7. #[derive(Fail, Debug)]
  8. pub enum PlaybackErr {
  9. #[fail(display = "Player Instance error: {}", _0)]
  10. Instance(&'static str),
  11. #[fail(display = "Player Media error: {}", _0)]
  12. Media(&'static str),
  13. }
  14.  
  15. pub fn test() -> Fallible<i32> {
  16. let value: Option<i32> = None;
  17. let r = value.ok_or(PlaybackErr::Media("Media out of sync."))?;
  18. Ok(r)
  19. }
  20.  
  21. fn main() {
  22. let _n = test();
  23. }
Add Comment
Please, Sign In to add comment