Crates.io | nothing |
lib.rs | nothing |
version | 0.1.12 |
source | src |
created_at | 2022-03-22 06:28:25.321278 |
updated_at | 2023-12-04 14:25:32.102593 |
description | Probably a better Option |
homepage | https://github.com/btwiuse/nothing |
repository | https://github.com/btwiuse/nothing |
max_upload_size | |
id | 554510 |
size | 9,657 |
nothing::[Probably] is a better [Option].
pub enum Probably<T> {
Nothing,
Something(T),
}
The point is that you can use [Probably] as the return type of your main function:
use nothing::{Probably, Nothing};
fn main() -> Probably<()> {
Nothing
}
Exit code is 0
if it is [Something], 1
if [Nothing].
You can even use the ?
operator the way you would with [Option] and [Result]. See ./examples/main.rs
Real-world examples:
Probably nothing.