Skip to content

kravlad/resopt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

resopt

A simple Go implementation of the Rust's Result and Option types.

Installation

go get github.com/kravlad/resopt/v1

Usage

    s := "123"
    res := resopt.NewResult(strconv.Atoi(s))
    res.Unwrap() // 123
    res.IsErr() // false
    m := map[string]string{"foo": "bar"}
    option := resopt.OptionFromMap(m, "foo")
    option.Unwrap() // "bar"

    option = resopt.OptionFromMap(m, "bar")
    option.IsNone() // true

See documentation for more examples

Documentation

GoDoc

About

A simple Go implementation of the Rust's Result and Option types.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages