option ~main
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 theOption
object contains a value;none
when theOption
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 theOption
is empty);isEmpty
to know whether theOption
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.
- Registered by asperan
- ~main released 3 years ago
- asperan/option
- MIT
- Copyright © 2021, Alex Speranza
- Authors:
- 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 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
40 downloads total
-
- Score:
- 0.0
- Short URL:
- option.dub.pm