Result and Option types
Paul Backus
snarwin at gmail.com
Sat Jul 25 19:26:16 UTC 2020
On Saturday, 25 July 2020 at 18:06:51 UTC, powerboat9 wrote:
> Does dlang have an analog to Result or Option types from rust?
In addition to Nullable in the standard library, there are some
packages on dub you might find useful:
* optional: an option type that can also function as a range, for
compatibility with std.algorithm.
Link: https://code.dlang.org/packages/optional
* expected: a result type with customizable error behavior (can
panic or throw on failed unwrap) and utility functions for
monadic error handling (map, andThen, orElse).
Link: https://code.dlang.org/packages/expected
More information about the Digitalmars-d-learn
mailing list