You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found it it pretty common to want to get at the value inside an Option, or propagate an error if it’s None. For example with Iterator::next, u32::checked_sub, etc. Do you think the macro below would make a good addition to the library?
For static string messages, anyhow::Context is pretty good for the same use case: let jobs = NonZeroU32::new(args.jobs).context("number of jobs must be non-zero")?;
There is .with_context(|| format!("...", ...))? but it wouldn't really be less verbose than the if let.
I found it it pretty common to want to get at the value inside an
Option
, or propagate an error if it’sNone
. For example withIterator::next
,u32::checked_sub
, etc. Do you think the macro below would make a good addition to the library?The text was updated successfully, but these errors were encountered: