Guest User

Untitled

a guest
Jul 20th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. use std::fmt::Debug;
  2.  
  3. enum ResultVal<V: Debug, E: Debug> {
  4. Error(E),
  5. Value(V)
  6. }
  7.  
  8. type TestResult = ResultVal<String, String>;
  9.  
  10. fn print_result(res: TestResult) {
  11. match res {
  12. TestResult::Error(e: String) => println!("Error: {:?}", e),
  13. TestResult::Value(v: String) => println!("We are good {:?}", v)
  14. }
  15. }
  16.  
  17. fn main() {
  18. let res_err:
Add Comment
Please, Sign In to add comment