Crate result_extensions
source · [−]Expand description
Result Extensions
A simple library that functionally creates Result<T, E> values from arbitrary types.
Usage:
mod some_mod {
use result_extensions::ResultExtensions;
fn is_greater_than_ten(input: i64) -> Result<bool, String> {
match input {
i64::MIN..=0 => {
"this function does not accept values less than or equal to zero for some reason"
.to_string()
.to_err()
}
1..=9 => false.to_ok(),
_ => true.to_ok(),
}
}
}
Traits
Allows any Sized type to be functionally moved into a Result<T, E>.