tafia / quick-protobuf

A rust implementation of protobuf parser
MIT License
452 stars 87 forks source link

errors: add Into<::std::io::Error> conversion #49

Closed koivunej closed 7 years ago

koivunej commented 7 years ago

This conversion helps when working with for example tokio-proto where Codec must use std::io::Error.

tafia commented 7 years ago

Thanks for the PR! We could probably git rid of all these io compatible variants directly when parsing. There is no real reason for having them apart me not knowing io errors well. Could you make the change before merging else I'll happily do it next.

koivunej commented 7 years ago

The only one of those I'd like to get rid of is std::string::FromUtf8Error which is essentially a wrapper around std::string::Utf8Error and the input that was incorrent. Luckily it was not used anywhere.

I think there is still value in keeping the variants for unit testing and anyone using the library in more permissive environment. I'll post another commit with the extra error removed.

koivunej commented 7 years ago

Looking at the diffs again, you probably meant removing of errors::ErrorKind::Eof in favor of the std::io::ErrorKind::UnexpectedEof. That's now removed as well.

tafia commented 7 years ago

Thanks!!