unsure 0.1.0

A Rust library for handling unsure (optional) values that might fail, with an additional rejection variant.
Documentation
  • Coverage
  • 100%
    10 out of 10 items documented1 out of 7 items with examples
  • Size
  • Source code size: 6.84 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 322.14 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • AeriaVelocity

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 using Unsure<T> over Option<T> - if you don't need to manage failure separately from absence, just stick with Option<T>.
  • Nothing: No value, like Option<T>'s None, used to mark a situation where an unsure state should be ignored or skipped. Takes its name after Haskell's Nothing variant of the Maybe type.
  • Just(T): Some value of type T, like Option<T>'s Some(T), used to confirm that an unsure state is valid and confirmed. Takes its name after Haskell's Just a variant of the Maybe type.

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.