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
use anyhow::Context;let map = HashMap::from([("a",1),("b",2),("c",3)]);let _ = map.get("d").with_context(|| format!("Key 'd' was missing from map: {map:?}"))?;
Currently the best way to do this with miette is by using a let else then bail!:
use miette::bail;let map = HashMap::from([("a",1),("b",2),("c",3)]);letSome(_) = map.get("d")else{
bail!("Key 'd' was missing from map: {map:?}"));};
I'm willing to implement this if desired
The text was updated successfully, but these errors were encountered:
anyhow
implements it'sContext
trait on options. This helps avoid some boilerplate:Currently the best way to do this with
miette
is by using alet else
thenbail!
:I'm willing to implement this if desired
The text was updated successfully, but these errors were encountered: