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

Make ZoneVariant a closed, non-exhaustive enum #5760

Merged
merged 5 commits into from
Nov 4, 2024
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
Prev Previous commit
Next Next commit
ffi
  • Loading branch information
robertbastian committed Nov 1, 2024
commit 0df3fe752dc644ce967d2dbfbd0562efaec23810
6 changes: 3 additions & 3 deletions ffi/capi/bindings/dart/TimeZoneInfo.g.dart

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

6 changes: 3 additions & 3 deletions ffi/capi/src/timezone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ pub mod ffi {
/// Sets the `zone_variant` field from a string.
///
/// Returns null if the string is not a valid zone variant.
#[diplomat::rust_link(icu::timezone::ZoneVariant, Struct, compact)]
#[diplomat::rust_link(icu::timezone::ZoneVariant, Enum, compact)]
#[diplomat::rust_link(icu::timezone::ZoneVariant::from_str, FnInStruct, hidden)]
pub fn try_set_zone_variant(&mut self, id: &DiplomatStr) -> Option<()> {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Delete these old functions. New variants will get new functions.

self.zone_variant = match id {
Expand All @@ -223,7 +223,7 @@ pub mod ffi {
}

/// Clears the `zone_variant` field.
#[diplomat::rust_link(icu::timezone::ZoneVariant, Struct, compact)]
#[diplomat::rust_link(icu::timezone::ZoneVariant, Enum, compact)]
pub fn clear_zone_variant(&mut self) {
self.zone_variant.take();
}
Expand All @@ -232,7 +232,7 @@ pub mod ffi {
///
/// Returns null if the `zone_variant` field is empty.
#[diplomat::rust_link(icu::timezone::TimeZoneInfo::zone_variant, FnInStruct)]
#[diplomat::rust_link(icu::timezone::ZoneVariant, Struct, compact)]
#[diplomat::rust_link(icu::timezone::ZoneVariant, Enum, compact)]
#[diplomat::attr(auto, getter)]
pub fn zone_variant(&self, write: &mut diplomat_runtime::DiplomatWrite) -> Option<()> {
let _infallible = write.write_str(match self.zone_variant {
Expand Down
2 changes: 1 addition & 1 deletion ffi/capi/tests/missing_apis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ icu::timezone::ZoneOffsetCalculator#Struct
icu::timezone::ZoneOffsetCalculator::compute_offsets_from_time_zone#FnInStruct
icu::timezone::ZoneOffsetCalculator::new#FnInStruct
icu::timezone::ZoneOffsets#Struct
icu::timezone::ZoneVariant::into_option#FnInStruct
icu::timezone::ZoneVariant::into_option#FnInEnum
icu::timezone::models::AtTime#Enum
icu::timezone::models::Base#Enum
icu::timezone::models::Full#Enum