Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sigmasoldi3r/result-saturnus

A simple library inspired by Rust's std result type.
https://github.com/sigmasoldi3r/result-saturnus

Last synced: about 1 month ago
JSON representation

A simple library inspired by Rust's std result type.

Awesome Lists containing this project

README

        

# Result (Saturnus)

A simple library inspired by Rust's std result type.

```rs
use { Ok, Err } in result;

fn something_that_might_fail(a, b) {
if b == 0 {
return Err("Divide by 0!");
} else {
return Ok(a / b);
}
}

let ok_value = something_that_might_fail(1, 2)->unwrap();
// ok_value == 0.5
```

## Installation

Just add this line to the Janus file, under `[dependencies]`:

```toml
result = { git = "https://github.com/sigmasoldi3r/result-saturnus" }
```