☕🐕
Utilities for working with type Fine<T, E> = (T, Result<(), E>)
.
It's a useful return type for map and set insertions.
The API is mostly a port of Result<T, E>
's.
Please use cargo-edit to always add the latest version of this library:
cmd
cargo add this-is-fine
This is a slightly incomplete API preview.
```rust use thisisfine::{Fine, prelude::*};
let fine: Fine<_, ()> = ((), Ok(()));
fine.fine(); // Discard any error.
fine.notfine(); // Convert to Result
.
fine.ok(); // .not_fine().ok()
fine.err(); // .1.err()
fine.isok(); // .1.is_ok()
fine.iserr(); // .1.is_err()
fine.asref(); // Like Result::as_ref
.
fine.map(|t| t); // Like Result::map
.
fine.map_err(|e| e); // Like Result::map_err
.
fine.expect("message"); // Like .fine
, but can panic.
fine.unwrap(); // "
let mut fine = fine;
fine.as_mut(); // Like Result::as_mut
.
// Some
error is still fine.
let fine = thisisfine::frominverse(((), Some(())));
fine.expecterr("message");
fine.unwrap_err();
fine.fine();
// Twice as fine.
let finefine: FineResult
s.
```
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
See CONTRIBUTING for more information.
this-is-fine
strictly follows Semantic Versioning 2.0.0 with the following exceptions:
This includes the Rust version requirement specified above.
Earlier Rust versions may be compatible, but this can change with minor or patch releases.
Which versions are affected by features and patches can be determined from the respective headings in CHANGELOG.md.