Result

  • Rust has a built in generic enum called Result that allows us to return a value that has the possibility of failing. It is the idiomatic way in which the language does error handling.

  • This enum is so common, instances of the enum can be created anywhere with the enum variants Ok and Err.


#![allow(unused)]
fn main() {
enum Result<T, E> {
    Ok(T),
    Err(E),
}
}