[][src]Enum tao_of_rust::ch02::errors_handle::Result

pub enum Result<T, E> {
    Ok(T),
    Err(E),
}

std::result::Result 定义

Basic usage:

let x: Result<i32, &str> = Ok(-3);
assert_eq!(x.is_ok(), true);

let x: Result<i32, &str> = Err("Some error message");
assert_eq!(x.is_ok(), false);Run

Rust 2018 main函数可以返回Result<T, E>

// use std::fs::File;
// fn main() -> Result<(), std::io::Error> {
//    let f = File::open("bar.txt")?;
//    Ok(())
// }Run

Variants

Auto Trait Implementations

impl<T, E> Send for Result<T, E> where
    E: Send,
    T: Send

impl<T, E> Sync for Result<T, E> where
    E: Sync,
    T: Sync

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.