Error kind() function private in hyper

Why does e.kind() work only for std::io::Error and for other types of errors, such as hyper, is either private or unavailable? This is very inconvenient when trying to construct any kind of general error handling.
The book suckered me into using e.kind() by singing its praises and showing examples with std::io::Error and then I find out it does not work with anything else.

I would like to be able to access e.kind() for any error, and dyn std::error::Error

That's because std::io::Error is an struct defined in the std::io module (which just happens to implement std::error::Error), and they've decided to give it a kind() method. The kind() method is completely unrelated to implementing the std::error::Error trait.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.