Trait ExpectedWithError

Source
pub trait ExpectedWithError<T>: Expected<T> {
    // Required methods
    fn or_exit_e<F>(self, msgf: F) -> T
       where F: FnOnce() -> String;
    fn or_die_e<F>(self, msgf: F) -> T
       where F: FnOnce() -> String;

    // Provided methods
    fn or_exit_e_(self, msg: &str) -> T { ... }
    fn or_die_e_(self, msg: &str) -> T { ... }
    fn expect_or_exit_perror_(self, msg: &str) -> T { ... }
    fn expect_or_exit_perror<F>(self, msgf: F) -> T
       where F: FnOnce() -> String { ... }
    fn expect_or_die_perror_(self, msg: &str) -> T { ... }
    fn expect_or_die_perror<F>(self, msgf: F) -> T
       where F: FnOnce() -> String { ... }
}
๐Ÿ‘ŽDeprecated: This module is in maintenance mode; the anyhow library might be a better choice
Expand description

Unwrap or exit with an appropriate error message.

Required Methodsยง

Source

fn or_exit_e<F>(self, msgf: F) -> T
where F: FnOnce() -> String,

๐Ÿ‘ŽDeprecated: This module is in maintenance mode; the anyhow library might be a better choice

Test the value. On success, return the unwrapped value. On error, unwind the stack, call the supplied function to obtain an error message, display it, append an appropriate description of the error, and exit.

Source

fn or_die_e<F>(self, msgf: F) -> T
where F: FnOnce() -> String,

๐Ÿ‘ŽDeprecated: This module is in maintenance mode; the anyhow library might be a better choice

Test the value. On success, return the unwrapped value. On error, do not unwind the stack, call the supplied function to obtain an error message, display it, append an appropriate description of the error, and exit.

Provided Methodsยง

Source

fn or_exit_e_(self, msg: &str) -> T

๐Ÿ‘ŽDeprecated: This module is in maintenance mode; the anyhow library might be a better choice

Test the value. On success, return the unwrapped value. On error, unwind the stack, display the specified message, append an appropriate description of the error, and exit.

Source

fn or_die_e_(self, msg: &str) -> T

๐Ÿ‘ŽDeprecated: This module is in maintenance mode; the anyhow library might be a better choice

Test the value. On success, return the unwrapped value. On error, do not unwind the stack, display the specified message, append an appropriate description of the error, and exit.

Source

fn expect_or_exit_perror_(self, msg: &str) -> T

๐Ÿ‘ŽDeprecated: This module is in maintenance mode; the anyhow library might be a better choice
Source

fn expect_or_exit_perror<F>(self, msgf: F) -> T
where F: FnOnce() -> String,

๐Ÿ‘ŽDeprecated: This module is in maintenance mode; the anyhow library might be a better choice
Source

fn expect_or_die_perror_(self, msg: &str) -> T

๐Ÿ‘ŽDeprecated: This module is in maintenance mode; the anyhow library might be a better choice
Source

fn expect_or_die_perror<F>(self, msgf: F) -> T
where F: FnOnce() -> String,

๐Ÿ‘ŽDeprecated: This module is in maintenance mode; the anyhow library might be a better choice

Dyn Compatibilityยง

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Typesยง

Sourceยง

impl<T, E> ExpectedWithError<T> for Result<T, E>
where E: Display,

Sourceยง

fn or_exit_e<F>(self, msgf: F) -> T
where F: FnOnce() -> String,

๐Ÿ‘ŽDeprecated: This module is in maintenance mode; the anyhow library might be a better choice
Sourceยง

fn or_die_e<F>(self, msgf: F) -> T
where F: FnOnce() -> String,

๐Ÿ‘ŽDeprecated: This module is in maintenance mode; the anyhow library might be a better choice

Implementorsยง