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

Bump Diplomat and use DiplomatStr[16] #4353

Merged
merged 7 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ icu_benchmark_macros = { path = "tools/benchmark/macros" }

# The version here can either be a `version = ".."` spec or `git = "https://github.com/rust-diplomat/diplomat", rev = ".."`
# Diplomat must be published preceding a new ICU4X release but may use git versions in between
diplomat = { git = "https://github.com/rust-diplomat/diplomat.git", rev = "f545acf50629b6f2135adca374507b717a821cd8" }
diplomat-runtime = { git = "https://github.com/rust-diplomat/diplomat.git", rev = "f545acf50629b6f2135adca374507b717a821cd8" }
diplomat_core = { git = "https://github.com/rust-diplomat/diplomat.git", rev = "f545acf50629b6f2135adca374507b717a821cd8" }
diplomat-tool = { git = "https://github.com/rust-diplomat/diplomat.git", rev = "f545acf50629b6f2135adca374507b717a821cd8" }
diplomat = { git = "https://github.com/rust-diplomat/diplomat.git", rev = "4e1046a3baf8a82da6f176cd945de1a2c51a7f0e" }
diplomat-runtime = { git = "https://github.com/rust-diplomat/diplomat.git", rev = "4e1046a3baf8a82da6f176cd945de1a2c51a7f0e" }
diplomat_core = { git = "https://github.com/rust-diplomat/diplomat.git", rev = "4e1046a3baf8a82da6f176cd945de1a2c51a7f0e" }
diplomat-tool = { git = "https://github.com/rust-diplomat/diplomat.git", rev = "4e1046a3baf8a82da6f176cd945de1a2c51a7f0e" }

# Size optimized builds
[profile.release-opt-size]
Expand Down
7 changes: 6 additions & 1 deletion components/timezone/src/iana_ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,15 @@ impl<'a> IanaToBcp47MapperBorrowed<'a> {
///
/// [ECMAScript Temporal]: https://tc39.es/proposal-temporal/#sec-isavailabletimezonename
pub fn get(&self, iana_id: &str) -> Option<TimeZoneBcp47Id> {
self.get_bytes(iana_id.as_bytes())
}

#[doc(hidden)]
pub fn get_bytes(&self, iana_id: &[u8]) -> Option<TimeZoneBcp47Id> {
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: this should be get_utf8 and it can be public. Compare to ComposingNormalizer::normalize and ::normalize_utf8

Copy link
Member Author

Choose a reason for hiding this comment

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

This is more similar to our from_bytes methods than to normalize_utf8, as it's basically a raw tinystr

Copy link
Member

Choose a reason for hiding this comment

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

This takes in a string and looks up in the data payload to find the corresponding tinystr if there is one. It is a data structure function. We're not doing any type conversions here so "from" is not accurate.

Besides, we're going to want get_utf16 here as well at some point I think. That is, unless, according to #2413, we want to make these functions named get, get8, and get16? I think "UTF-16" is seen as more of an adjective though, and the reason get_u32 was confusion to basically everyone was because "u32" is a noun.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is why I want to keep it doc-hidden for now, I don't want to block this PR on name bikeshedding.

Copy link
Member

Choose a reason for hiding this comment

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

Please make a follow up issue for this because adding doc hidden APIs is tech debt.

Copy link
Member Author

Choose a reason for hiding this comment

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

// The longest IANA name in CLDR appears to be "America/Argentina/ComodRivadavia"
// which is 32 characters long, so 48 should be plenty. Add a debug assertion
// just in case.
let name_for_lookup = match tinystr::TinyAsciiStr::<48>::from_str(iana_id) {
let name_for_lookup = match tinystr::TinyAsciiStr::<48>::from_bytes(iana_id) {
Ok(tinystr) => tinystr.to_ascii_lowercase(),
Err(tinystr::TinyStrError::TooLarge { .. }) => {
debug_assert!(false, "IANA string too long for lookup");
Expand Down
30 changes: 5 additions & 25 deletions ffi/capi/dart/package/lib/src/Collator.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 4 additions & 36 deletions ffi/capi/dart/package/lib/src/GraphemeClusterSegmenter.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 4 additions & 36 deletions ffi/capi/dart/package/lib/src/LineSegmenter.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 4 additions & 36 deletions ffi/capi/dart/package/lib/src/SentenceSegmenter.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading