Do we have other const functions that might be affected by the same problem? I wonder what a long-term solution could be here.
In the issue, you said that the problem is the io::Error in Kind? I tried previously to remove that one because it only appears in certain functions. Perhaps that is worth exploring because most functions don't actually return an io::Error.
If you'd like my opinion, you should impl From<YourErrorType> for std::io::Error, and have io functions return an io::Result, which may be InvalidData with a source = Some(YourErrorType), where YourErrorType is a slimmer Error
(This would be a breaking change.)
((I think that's fine, you're pre 1.0.0, and the API should be allowed to evolve past current limitations))
If you'd like my opinion, you should
impl From<YourErrorType> for std::io::Error
, and have io functions return anio::Result
, which may beInvalidData
with asource = Some(YourErrorType)
, whereYourErrorType
is a slimmerError
(This would be a breaking change.) ((I think that's fine, you're pre 1.0.0, and the API should be allowed to evolve past current limitations))
Originally posted by @aatifsyed in https://github.com/multiformats/rust-multihash/pull/331#issuecomment-1642486508