I'd like to use a type returned by a function in crate A that is actually defined in crate B, but crate A doesn't reexport it.
Although I can explicitly add crate B in my Cargo.toml
, I'm not sure how to keep its version sync with the one used in crate A.
To be more specific, the type is url::ParseError
, crate A is reqwest
and crate B is url
.
There are no "official" guidelines around this issue. There was a discussion regarding best practices a while back with no definite conclusion. Many crates wrap external types so they aren't exposed directly, or they re-export items. This specific issue with reqwest was discussed here and it was decided to not re-export url::ParseError
:
My personal feeling is that this is somewhat niche, and so for those who don't need it, it just clutters the API. For anyone who does need to inspect for this specific error, they can add the
url
crate as a dependency.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With