Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/sigmasoldi3r/result-saturnus
- Owner: sigmasoldi3r
- License: mit
- Created: 2023-12-26T13:11:00.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-26T13:27:41.000Z (about 1 year ago)
- Last Synced: 2024-05-20T15:12:08.675Z (8 months ago)
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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" }
```