Skip to content

Implement Maps for strings#14869

Merged
1 commit merged into
mainfrom
test_584306911
Dec 7, 2023
Merged

Implement Maps for strings#14869
1 commit merged into
mainfrom
test_584306911

Conversation

@copybara-service

Copy link
Copy Markdown

Implement Maps for strings

This change implements maps with keys and values of type string e.g. Map<ProtoStr, i32> and Map<ProtoStr, ProtoStr>.

Implementing the Map type for ProtoStr has been different from scalar types because ProtoStr is an unsized type i.e. its size is not known at compile time. The existing Map implementation assumed sized types in many places. To make unsized types fit into the existing code architecture I have added an associated type 'Value' to the MapWith*KeyOps traits. The associated type needs to be sized and is the type returned by the Map::get(self, key) method e.g. for aProtoStr, the type Value = &ProtoStr.

@copybara-service copybara-service Bot force-pushed the test_584306911 branch 8 times, most recently from 5528344 to d4ad022 Compare December 7, 2023 15:05
This change implements maps with keys and values of type string e.g. Map<ProtoStr, i32> and Map<ProtoStr, ProtoStr>.

Implementing the Map type for ProtoStr has been different from scalar types because ProtoStr is an unsized type i.e. its size is not known at compile time. The existing Map implementation assumed sized types in many places. To make unsized types fit into the existing code architecture I have added an associated type 'Value' to the MapWith*KeyOps traits. The associated type needs to be sized and is the type returned by the Map::get(self, key) method e.g. for aProtoStr, the `type Value = &ProtoStr`.

PiperOrigin-RevId: 588783751
@copybara-service copybara-service Bot closed this pull request by merging all changes into main in 9760292 Dec 7, 2023
@copybara-service copybara-service Bot closed this Dec 7, 2023
@copybara-service copybara-service Bot deleted the test_584306911 branch December 7, 2023 15:25
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.

1 participant