Skip to content

nonnil/resultsutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"

About

Utility macros for easier handling of Result

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages