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§
Sourcefn label_error(self, label: L) -> Result<T, ErrorTree<L, E>>
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");