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

Add a helper function that uses base64::write::EncoderWriter #4483

Closed
Xuanwo opened this issue Apr 13, 2024 · 1 comment
Closed

Add a helper function that uses base64::write::EncoderWriter #4483

Xuanwo opened this issue Apr 13, 2024 · 1 comment

Comments

@Xuanwo
Copy link
Member

Xuanwo commented Apr 13, 2024

          We can add a helper function that uses [base64::write::EncoderWriter](https://docs.rs/base64/0.22.0/base64/write/struct.EncoderWriter.html). But I believe it's out of the scope of current PR, maybe worth a new one.

Originally posted by @Xuanwo in #4477 (comment)

BASE64_STANDARD.encode(body) requires the whole slices which adds an extra copy for Buffer. We can use base64::write::EncoderWriter to allow build base64 from Buffer.

@Xuanwo
Copy link
Member Author

Xuanwo commented Apr 13, 2024

Ah, EncoderWriter is not zero cost compared to encode. Maybe it's better to use Buffer::to_bytes() as is. Closing.

@Xuanwo Xuanwo closed this as not planned Won't fix, can't repro, duplicate, stale Apr 13, 2024
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

1 participant