Even more option types for D.
To use this package, run the following command in your project's root directory:
Put the following dependency into your project's dependences section:
= Options for D!
Comes in 2 flavors!
Definitely done before!
=== What is this?
A small minded implementation of option types in D.
=== Why not just use <other option lib>?
You should definitely use <other option lib>.
=== Will it finally allow me to download a car?
It absolutely will, yes.
== Use the things
option(T) struct form for when you want structs
auto foo = none!int; auto bar = some(3); auto fizz = maybe!(int)(null); auto buzz = some!(int)(null); // ERROR
Option(T) class form for when you want classes
auto foo = Options.none!int(); auto bar = Options.some(3); auto fizz = Options.maybe!(int)(null); auto buzz = Options.some!(int)(null); // ERROR
!= Overload for when you want to use
auto noneA = none!int; auto noneB = none!int; auto some2a = some!int(2); auto some2b = some!int(2); auto some3 = some!int(3);
assert(noneA == noneB); assert(noneA != some3); assert(some2a == some2b); assert(some2a != some3);
- Registered by Elizabeth Harper
- ~master released 4 years ago
- Copyright © 2018, Elizabeth Harper