eyre-rs / eyre

A trait object based error handling type for easy idiomatic error handling and reporting in Rust applications
Apache License 2.0
1.41k stars 66 forks source link

Add `prelude` module #63

Open lilyball opened 2 years ago

lilyball commented 2 years ago

It might be nice to have a prelude module that contains the macros, Report, and WrapErr. This way use eyre::prelude::*; will be equivalent to

use eyre::{bail, ensure, eyre, Report, WrapErr};

as those are the items I typically want to import everywhere I use eyre (more specifically I only import the macros I use so I don't get warnings, but that the means the other macros aren't available when I want them).

Notably this should not include Result, as taking over the bare Result identifier without explicitly importing it would be surprising.

joshtriplett commented 4 months ago

I'd love to see this. I think this prelude should also include OptionExt for the ok_or_eyre function.