Skip to content

Introduce a matcher for byte sequences which represent UTF-8 encoded strings #327

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

Merged
4 commits merged into from
Dec 15, 2023

Conversation

hovinen
Copy link
Collaborator

@hovinen hovinen commented Nov 26, 2023

This allows the use of all matchers for string types on such types. These types come up often when working with various types of I/O, so matching on them can be useful.

This currently only supports UTF-8 encoding, but could be extended for other encodings with the addition of a suitable (presumably optional) dependency.

Note: Currently, due to #323, this only compiles with an additional change which introduces extra allocation on each matches call. I've put that in a separate commit.

…strings.

This allows the use of all matchers for string types on such types. These types come up often when working with various types of I/O, so matching on them can be useful.

This currently only supports UTF-8 encoding, but could be extended for other encodings with the addition of a suitable (presumably optional) dependency.
This fixes the lifetime problems in `IsEncodedStringMatcher` at the cost of an extra allocation: the input must be copied to a `Vec<u8>`, then converted to a `String`.
@hovinen hovinen force-pushed the add-matcher-for-utf8-byte-sequences branch from 8a271e6 to e6a8c7f Compare November 26, 2023 17:30
@copybara-service copybara-service bot closed this pull request by merging all changes into main in 281b6b8 Dec 15, 2023
@gribozavr gribozavr deleted the add-matcher-for-utf8-byte-sequences branch February 17, 2025 18:29
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

Successfully merging this pull request may close these issues.

2 participants