Trait Expected

Source
pub trait Expected<T>
where Self: Sized,
{ // Required methods fn or_exit<F>(self, msgf: F) -> T where F: FnOnce() -> String; fn or_die<F>(self, msgf: F) -> T where F: FnOnce() -> String; // Provided methods fn or_exit_(self, msg: &str) -> T { ... } fn or_die_(self, msg: &str) -> T { ... } fn expect_or_exit_(self, msg: &str) -> T { ... } fn expect_or_exit<F>(self, msgf: F) -> T where F: FnOnce() -> String { ... } fn expect_or_die_(self, msg: &str) -> T { ... } fn expect_or_die<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 the specified message.

Required Methodsยง

Source

fn or_exit<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, and exit.

Source

fn or_die<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, and exit.

Provided Methodsยง

Source

fn or_exit_(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, and exit.

Source

fn or_die_(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, and exit.

Source

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

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

Alias for Expected::or_exit_.

Source

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

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

Alias for Expected::or_exit.

Source

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

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

Alias for Expected::or_die_.

Source

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

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

Alias for Expected::or_die.

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 Expected<bool> for bool

Sourceยง

fn or_exit<F>(self, msgf: F) -> Self
where F: FnOnce() -> String,

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

fn or_die<F>(self, msgf: F) -> Self
where F: FnOnce() -> String,

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

impl<T> Expected<T> for Option<T>

Sourceยง

fn or_exit<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<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ยง

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

Sourceยง

fn or_exit<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<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ยง