Skip to main content

ResultExt

Trait ResultExt 

Source
pub trait ResultExt {
    type Ok;

    // Required methods
    fn unwrap_or_abort(self) -> Self::Ok;
    fn expect_or_abort(self, msg: &str) -> Self::Ok;
}
Expand description

This traits expands Result<T, Into<Diagnostic>> with some handy shortcuts.

Required Associated Types§

Required Methods§

Source

fn unwrap_or_abort(self) -> Self::Ok

Behaves like Result::unwrap: if self is Ok yield the contained value, otherwise abort macro execution via abort!.

Source

fn expect_or_abort(self, msg: &str) -> Self::Ok

Behaves like Result::expect: if self is Ok yield the contained value, otherwise abort macro execution via abort!. If it aborts then resulting error message will be preceded with message.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T, E: Into<Diagnostic>> ResultExt for Result<T, E>

Source§

type Ok = T

Source§

fn unwrap_or_abort(self) -> T

Source§

fn expect_or_abort(self, message: &str) -> T

Implementors§