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

Return &mut str from encode_to_slice #72

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

elichai
Copy link

@elichai elichai commented Jul 30, 2022

I use this crate a lot, especially in no_std or performance-sensitive environments. and I use encode_to_slice quite a lot, and usually, I need then to convert the slice into an str to pass to a serializer/formatter.
I think it makes sense that encode_to_slice will return a &mut str because it just checked all the invariants and can verify that in debug mode.

Sadly this breaks the API in the rare case where the returned () was used, so bumped to 0.5.

@elichai
Copy link
Author

elichai commented Jul 31, 2022

The errors are completely unrelated to this PR, I can still fix them if you prefer (although I'm not sure if changing the lint name will break older rustc versions)

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

Successfully merging this pull request may close these issues.

None yet

2 participants