option 2.0.2

A simple library for optional values.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

Option

Option is a library for D. To avoid using null around the code, it introduce a Option type which wraps a possible-empty value.

The library provides:

  • static methods to create Option objects:
  • some when the Option object contains a value;
  • none when the Option object does not contain a value;
  • nullable when it is not known a priori whether the value exists or not;
  • class methods to retrieve essential informations about the Option object:
  • get to unwrap the value (throws an error when the Option is empty);
  • isEmpty to know whether the Option object is empty (value not present) or not;
  • or to retrieve the wrapped value if is present, else the passed value (used as the default value). This method never throws.
Authors:
  • Alex "asperan" Speranza
Dependencies:
none
Versions:
2.0.2 2021-Oct-13
2.0.1 2021-Oct-13
2.0.0 2021-Oct-13
~main 2021-Oct-13
Show all 4 versions
Download Stats:
  • 0 downloads today

  • 7 downloads this week

  • 7 downloads this month

  • 7 downloads total

Score:
0.4
Short URL:
option.dub.pm