Unsure<T> Enum
Unsure<T> is a custom enum which is essentially
Option<T>
with an additional Reject variant, for handling values that are deemed to be
wholly negative (such as a failure state or an invalid input).
Its variants are:
Reject: An erroneous or unwanted value, used to mark a situation where an unsure state should be rejected or cancelled. This is the main reason for usingUnsure<T>overOption<T>- if you don't need to manage failure separately from absence, just stick withOption<T>.Nothing: No value, likeOption<T>'sNone, used to mark a situation where an unsure state should be ignored or skipped. Takes its name after Haskell'sNothingvariant of theMaybetype.Just(T): Some value of typeT, likeOption<T>'sSome(T), used to confirm that an unsure state is valid and confirmed. Takes its name after Haskell'sJust avariant of theMaybetype.
Installation
unsure-rs (unsure on crates.io) is a library crate, so you must add it to
an existing Rust project:
cargo add unsure
You can additionally type it out manually in Cargo.toml, but using the CLI
is easier.
Usage
See the docs.rs for usage instructions and detailed explanations of the enum.