Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Serialize/Deserialize for std::io::ErrorKind #1480

Closed
bddap opened this issue Feb 14, 2019 · 2 comments
Closed

Implement Serialize/Deserialize for std::io::ErrorKind #1480

bddap opened this issue Feb 14, 2019 · 2 comments

Comments

@bddap
Copy link

bddap commented Feb 14, 2019

ErrorKind is a simple enum so hopefully implementing ser/de would be straightforward.

One use case: structured error reporting in networked apis. The function:

fn frob() -> Result<bool, io::ErrorKind>;

could be turned into an rpc call.

@bddap
Copy link
Author

bddap commented Feb 15, 2019

io:ErrorKind docs

@dtolnay
Copy link
Member

dtolnay commented Feb 15, 2019

Thanks! I would prefer not to provide these impls because this seems pretty specific to your use case -- I don't recall having seen Result<T, io::ErrorKind> before. I would recommend using serialize_with or a newtype wrapper to provide the serialization logic yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants