3 ms·
The operator is just syntax sugar for something roughly this let foo = foo()?; // Expanded let foo = match foo() { Ok(v) => v, Err(e)
by ccakes 5y ago
The operator is just syntax sugar for something roughly this
let foo = foo()?;
// Expanded
let foo = match foo() {
Ok(v) => v,
Err(e) => return Err(From::from(e))
};
If you're using your own error type then you can impl From/Into yourself to capture additional context from the source error (or a stacktrace) in addition to using map_err() as others have suggested