#enums #options #better

nightly nothing

Probably a better Option

13 releases

0.1.12 Dec 4, 2023
0.1.11 Apr 26, 2022
0.1.1 Mar 22, 2022

#20 in #better

Download history 19/week @ 2024-02-16 20/week @ 2024-02-23 7/week @ 2024-03-01 14/week @ 2024-03-08 5/week @ 2024-03-15 47/week @ 2024-03-29 16/week @ 2024-04-05

63 downloads per month
Used in 4 crates

MIT license

6KB
94 lines

nothing

crates.io Documentation Build Status

nothing::[Probably] is a better [Option].

pub enum Probably<T> {
    Nothing,
    Something(T),
}

Why?

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

Probably::Nothing

Not convinced?

Real-world examples:

Probably nothing.

Dependencies

~1.5MB
~36K SLoC