Skip to content

ComptimeStringMap: Add version that takes an equality function #17148

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
merged 1 commit into from
Sep 14, 2023

Conversation

squeek502
Copy link
Collaborator

This will allow users to construct e.g. a ComptimeStringMap that uses case-insensitive ASCII comparison.

Note: the previous ComptimeStringMap API is unchanged (i.e. this does not break any existing code).

(the motivating use case for this comes from #17069)

Prior art: #5520

This will allow users to construct e.g. a ComptimeStringMap that uses case-insensitive ASCII comparison.

Note: the previous ComptimeStringMap API is unchanged (i.e. this does not break any existing code).
@andrewrk andrewrk merged commit c9613e3 into ziglang:master Sep 14, 2023
@Jarred-Sumner
Copy link
Contributor

FWIW, we had a similar need in Bun and rather than a single hardcoded equality function, we needed multiple equality functions for different usecases.

https://github.com/oven-sh/bun/blob/main/src/comptime_string_map.zig#L185-L199

@squeek502
Copy link
Collaborator Author

@Jarred-Sumner that is similar to the approach taken in #5520. Definitely seems possible that it's a better way to go.

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.

4 participants