-
Notifications
You must be signed in to change notification settings - Fork 183
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much nicer!
/automerge |
match zone_variant { | ||
ZoneVariant::Standard => &locations.pattern_standard, | ||
ZoneVariant::Daylight => &locations.pattern_daylight, | ||
_ => unreachable!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Annotate here and elsewhere that this is unreachable due to the tilde dependency
ffi/capi/src/timezone.rs
Outdated
Some(icu_timezone::ZoneVariant::Daylight) => "dt", | ||
Some(icu_timezone::ZoneVariant::Standard) => "st", | ||
_ => return None, | ||
}); | ||
Some(()) | ||
} | ||
|
||
/// Sets the `zone_variant` field to "standard" time, which may or may | ||
/// not correspond to a display name with "Standard" in its name. | ||
#[diplomat::rust_link(icu::timezone::ZoneVariant::standard, FnInStruct)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Update the rust link
ffi/capi/src/timezone.rs
Outdated
@@ -211,17 +211,19 @@ 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<()> { |
There was a problem hiding this comment.
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.
#5745