Skip to content

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 elichai force-pushed the encode_to_slice_str branch from fd5dff0 to 0909f06 Compare July 31, 2022 09:45
@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)

Copy link

@hkBst hkBst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, but a concern may be that it would not work with #[forbid(unsafe)], which some people are interested in.

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.

3 participants