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

Please provide a Writer that encodes to String #141

Closed
joshtriplett opened this issue Aug 31, 2020 · 4 comments
Closed

Please provide a Writer that encodes to String #141

joshtriplett opened this issue Aug 31, 2020 · 4 comments
Assignees

Comments

@joshtriplett
Copy link

I'd like to use base64 as a Writer, so that I can use a serde serializer followed by base64, without an intermediate buffer. However, base64::write::EncoderWriter always wraps another Writer. I'd like to get a String out, so that I have a type-level guarantee of valid UTF-8 (which base64 will always produce). Would you consider adding a base64::write::StringWriter that writes to a String, and returns that string from finish()?

@marshallpierce
Copy link
Owner

That sounds reasonable.

@marshallpierce marshallpierce self-assigned this Sep 23, 2020
@marshallpierce
Copy link
Owner

Does #142 address your use case?

@joshtriplett
Copy link
Author

@marshallpierce Yes, that looks great! I left one comment there, about avoiding a copy of the data, but otherwise that would work perfectly for my use case.

@marshallpierce
Copy link
Owner

Released in v0.13.0.

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