result 1.0.0

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),
  ));
Authors:
  • Alex "asperan" Speranza
Dependencies:
none
Versions:
1.0.0 2021-Oct-16
~main 2021-Oct-16
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 1 downloads this week

  • 1 downloads this month

  • 12 downloads total

Score:
0.4
Short URL:
result.dub.pm