Trait LabelResult

Source
pub trait LabelResult<T, L, E> {
    // Required method
    fn label_error(self, label: L) -> Result<T, ErrorTree<L, E>>;
}
Expand description

Convenience trait to label errors within a Result.

Required Methods§

Source

fn label_error(self, label: L) -> Result<T, ErrorTree<L, E>>

Maps a label to the ErrorTree within the result.

struct Error(String);
let result: Result<(), ErrorTree<&'static str, Error>> = Ok(());
let labeled_result = result.label_error("the label");

Implementations on Foreign Types§

Source§

impl<T, L, E> LabelResult<T, L, E> for Result<T, ErrorTree<L, E>>

Source§

fn label_error(self, label: L) -> Result<T, ErrorTree<L, E>>

Source§

impl<T, L, E> LabelResult<T, L, E> for Result<T, E>
where ErrorTree<L, E>: From<E>,

Source§

fn label_error(self, label: L) -> Result<T, ErrorTree<L, E>>

Implementors§