Closed LeoniePhiline closed 9 months ago
Previously, a closure and macro invocation was required to generate a static string error object from an Option::None.
Option::None
This change adds an extension trait, providing the ok_or_eyre method on the Option type.
ok_or_eyre
Option
Option::ok_or_eyre accepts static error messages and creates Report objects lazily in the None case.
Option::ok_or_eyre
Report
None
Implements #125
I will merge this now as it looks splendid. If you find a better way to make it discoverable; feel free to open up another PR 😊
Previously, a closure and macro invocation was required to generate a static string error object from an
Option::None
.This change adds an extension trait, providing the
ok_or_eyre
method on theOption
type.Option::ok_or_eyre
accepts static error messages and createsReport
objects lazily in theNone
case.Implements #125