Crate string_error_wrap

Source
Expand description

§string_error_wrap

Crate for easily creating error types wrapping String.

This can be extremely useful for dealing with libraries using String as an error type in some functions when you use something like anyhow.

§Usage

// generates error type
string_error_wrap::wrapper!(SomeError);

fn main() -> Result<(), SomeError> {
    // other_function returns a Result<T, String>
    // but that can be converted into Result<T, SomeError>
    // allowing the use of ?
    other_function().map_err(SomeError::from)?;
}

Macros§

wrapper_gen
Generates a String-wrapping error type