result ~main
A minimal D library to wrap return values or error of functions.
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:
Result
Result is a D library which provides the type Result
, which wraps the return value of a function or an Error
.
The type Result
mimics Either
from Scala or Result
from Rust.
Result(T)
is just an alias for SumType!(T, Error)
, so it can be used with any function from std.sumtype
.
Usage example
Result!int result = 5;
result.match!(
(int i) => i == 5,
(Error e) => exit(1),
));
- Registered by asperan
- ~main released 3 years ago
- asperan/result
- MIT
- Copyright © 2021, Alex "asperan" Speranza
- Authors:
- Dependencies:
- none
- Versions:
-
1.0.0 2021-Oct-16 ~main 2021-Oct-16 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
2 downloads this month
-
15 downloads total
-
- Score:
- 0.0
- Short URL:
- result.dub.pm