Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::fmt::Debug;
- enum ResultVal<V: Debug, E: Debug> {
- Error(E),
- Value(V)
- }
- type TestResult = ResultVal<String, String>;
- fn print_result(res: TestResult) {
- match res {
- TestResult::Error(e: String) => println!("Error: {:?}", e),
- TestResult::Value(v: String) => println!("We are good {:?}", v)
- }
- }
- fn main() {
- let res_err:
Add Comment
Please, Sign In to add comment