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

[encoding] Extend TextCodec with decode_to and encode_to #278

Closed
wants to merge 3 commits into from

Conversation

Enet4
Copy link
Owner

@Enet4 Enet4 commented Sep 14, 2022

This extends the TextCodec trait to also have encode_to and decode_to methods, which take a heap allocated buffer value instead of returning a new one. This makes it possible to reduce the number of allocations needed in some cases.

It is a breaking change because the trait is not sealed and implementations are required to provide definitions for these new methods.

[breaking change]
- encode_to pushes encoded string into an existing Vec<u8>
- decode_to pushes decoded string into an existing String
- provide default implementations for `decode` and `encode`
  based on `decode_to` and `encode_to`
in places where it can draw more benefits
by avoiding allocations
in places where it can draw more benefits
by avoiding allocations
@Enet4 Enet4 added enhancement breaking change Hint that this may require a major version bump on release A-lib Area: library labels Sep 14, 2022
@Enet4 Enet4 mentioned this pull request Sep 15, 2022
6 tasks
@Enet4 Enet4 changed the title Extend TextCodec with decode_to and encode_to [encoding] Extend TextCodec with decode_to and encode_to Oct 24, 2022
@Enet4 Enet4 added the C-encoding Crate: dicom-encoding label Dec 12, 2022
@Enet4 Enet4 marked this pull request as draft June 7, 2023 20:52
@Enet4
Copy link
Owner Author

Enet4 commented Jun 7, 2023

I will put this on hold until attempts are made to integrate with new text encoding libraries.

@Enet4
Copy link
Owner Author

Enet4 commented Apr 13, 2024

Closing because I'm not sure this is the right direction for text encoding/decoding, and it's gone far behind by other changes.

@Enet4 Enet4 closed this Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lib Area: library breaking change Hint that this may require a major version bump on release C-encoding Crate: dicom-encoding enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant