Crates.io | result-extensions |
lib.rs | result-extensions |
version | 1.0.2 |
source | src |
created_at | 2022-09-20 16:11:02.311342 |
updated_at | 2022-09-20 16:56:33.803549 |
description | A simple rust library that provides extensions for the Result |
homepage | |
repository | https://github.com/hyperschwartz/result-extensions |
max_upload_size | |
id | 670017 |
size | 15,282 |
An extremely simple library that provides extension traits for the standard Rust library's Result<T, E>
type.
This library adds "extension functions" to all Sized
values to allow them to be moved into Result
types:
use result_extensions::ResultExtensions;
fn result_function(bool: is_err) -> Result<String, String> {
if is_err {
"error!".to_string().to_err()
} else {
"ok!".to_string().to_ok()
}
}