mirror of
https://github.com/nonnil/resultsutils
synced 2026-01-15 04:41:49 +00:00
No description
| .github/workflows | ||
| src | ||
| tests | ||
| LICENCE | ||
| README.md | ||
| resultsutils.nimble | ||
resultsutils
resultutils to make Result handling easier.
inspired by optionsutils.
Usage
import results, resultsutils
func greet(name: string): Result[string, string] =
if name.len > 0:
return ok("hi, " & name)
return err("No name? 😐")
let hiNim: string = match greet "Nim":
Ok(greet):
greet
Err(_):
"Oh no! something went wrong 😨"
assert hiNim == "hi, Nim"
more code examples can be found here
Installation
nimble install resultsutils
or add a dependency to your .nimble file:
requires "resultsutils"