I’m a little bit confused about some details of my
My confusion is mainly about how to satisfy the
(&self) -> Option<&(dyn Error + 'static)>.
Here’s the playground link.
As you can see in the playground, the error type contained in
MyError is not
'static (Question: should it be?). But
Error::source requires that I return something
'static. Isn’t there a mismatch? Can I return something
'static if I only have something non-
The casting at the bottom of the playground also makes me sort of uneasy.
self.error.as_ref().map(|e| e.as_ref() as _). Is this sound at all? Why is the casting needed in items 3 and 4, but not in item 2?
Happy to hear any explanation, thank you.