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 have noticed that calling as_ref() on error returned from anyhow::Result<T> always errors with type must be known at this point. It seems that simply casting to dyn Error works fine however requires that weird hoop before I can call my own traits implemented for anything that looks like std::error::Error:
let dyn_error = err.as_ref()as&dyn std::error::Error;
I looked at the source code and I am genuinely confused, what's going on there and how can one access &dyn std::error::Error from anyhow::Error without going through explicit cast?
Thanks.
The text was updated successfully, but these errors were encountered:
Hi,
I have noticed that calling
as_ref()
on error returned fromanyhow::Result<T>
always errors withtype must be known at this point
. It seems that simply casting todyn Error
works fine however requires that weird hoop before I can call my own traits implemented for anything that looks likestd::error::Error
:I looked at the source code and I am genuinely confused, what's going on there and how can one access
&dyn std::error::Error
fromanyhow::Error
without going through explicit cast?Thanks.
The text was updated successfully, but these errors were encountered: