Trait proc_macro_error::ResultExt[][src]

pub trait ResultExt {
    type Ok;
    fn unwrap_or_abort(self) -> Self::Ok;
fn expect_or_abort(self, msg: &str) -> Self::Ok; }
[]

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

Associated Types

type Ok[src]

Required methods

fn unwrap_or_abort(self) -> Self::Ok[src][]

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

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

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.

Implementations on Foreign Types

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

type Ok = T

Implementors