Trait ChangeError

Source
pub trait ChangeError<T> {
    // Required method
    fn set_error(self, s: &str) -> Result<T, String>;
}
Expand description

Import this trait to get the set_error method on Results and Options

§Examples

use set_error::ChangeError;
let foo: Option<u32> = None;
assert_eq!(Err(String::from("erorr")), foo.set_error("erorr"));

Required Methods§

Source

fn set_error(self, s: &str) -> Result<T, String>

If an error is present it is replaced with the string passed into this method.

Implementations on Foreign Types§

Source§

impl<T> ChangeError<T> for Option<T>

Source§

fn set_error(self, s: &str) -> Result<T, String>

Source§

impl<T, E> ChangeError<T> for Result<T, E>

Source§

fn set_error(self, s: &str) -> Result<T, String>

Implementors§