Closed
Description
anyhow::Error
is smaller than Box<dyn Error>
; it pulls some tricks to store itself in one pointer rather than two. It's also more convenient to use; for instance, anyhow::Result<T>
is an alias for Result<T, anyhow::Error>
, and anyhow::Error
already implies Send
and Sync
so you don't have to specify them. And anyhow will make it easier to provide additional context on errors.
You might consider switching code that currently uses Box<dyn Error>
(or similar), and benchmarking to see if it has any performance impact. (Even if it doesn't provide a noticeable improvement, if it doesn't cause a regression it'd probably still be worth switching.)