Lyricdev
GitHub

enum Result

pub enum Result<T, E :: [Error]>

Holds a failure as a value: Ok with the value or Err with the error.

A result is kept, collected or decided on later. Two bridges lead to throws and back: Result.of { try f() } catches into one, try r.get() throws out of one. E is an Error, which get() throws.

Variants

Ok(T)
Err(E)

Methods

pub static fn of(f: fn() -> T throws E): Result<T, E>

Calls f and returns what it returns as Ok, what it throws as Err.

pub fn get(): T throws E

Returns an Ok's value.

Errors

Throws an Err's error.