3 ms·
Yep, if you want wrapped errors in Rust, you use the anyhow crate. It leans heavily into dyn so has some performance tradeoffs, but it's roughly the same perfor
by kbolino 2y ago
Yep, if you want wrapped errors in Rust, you use the anyhow crate. It leans heavily into dyn so has some performance tradeoffs, but it's roughly the same performance-wise as Go's error interface (which also uses a vtable under the hood).
- kibwen 2y agoThough using a dynamic error in Rust should only impose an allocation cost on the error path, and I presume Go is the same.