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

Remove error from to_string / to_vec #6

Closed
dtolnay opened this issue Sep 16, 2019 · 1 comment
Closed

Remove error from to_string / to_vec #6

dtolnay opened this issue Sep 16, 2019 · 1 comment

Comments

@dtolnay
Copy link
Contributor

dtolnay commented Sep 16, 2019

The to_string and to_vec functions are currently defined to return Result<..., serde_json::Error>. serde_json guarantees that serializing to string will only fail if the type's Serialize impl decides to fail or if the type does not map to legal json, for example because of non-string keys. For syn-serde all of the data structures are designed to be compatible with json and their Serialize impls never decide to fail on their own, so it should be fine to unwrap the errors from serde_json::to_string and remove those errors from the API of syn-serde.

to_writer still needs to return Result because std::io is all fallible.

@taiki-e
Copy link
Owner

taiki-e commented Sep 16, 2019

Thanks! Published v0.2.0 which fixes this issue.

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

No branches or pull requests

2 participants