1 // This file is part of ICU4X. For terms of use, please see the file
2 // called LICENSE at the top level of the ICU4X source tree
3 // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
7 use crate::errors::ffi::ICU4XError;
8 use crate::provider::ffi::ICU4XDataProvider;
10 use icu_timezone::MetazoneCalculator;
12 /// An object capable of computing the metazone from a timezone.
14 /// This can be used via `maybe_calculate_metazone()` on [`ICU4XCustomTimeZone`].
16 /// [`ICU4XCustomTimeZone`]: crate::timezone::ffi::ICU4XCustomTimeZone
18 #[diplomat::rust_link(icu::timezone::MetazoneCalculator, Struct)]
19 pub struct ICU4XMetazoneCalculator(pub MetazoneCalculator);
21 impl ICU4XMetazoneCalculator {
22 #[diplomat::rust_link(icu::timezone::MetazoneCalculator::new, FnInStruct)]
24 provider: &ICU4XDataProvider,
25 ) -> Result<Box<ICU4XMetazoneCalculator>, ICU4XError> {
26 Ok(Box::new(ICU4XMetazoneCalculator(call_constructor!(
27 MetazoneCalculator::new [r => Ok(r)],
28 MetazoneCalculator::try_new_with_any_provider,
29 MetazoneCalculator::try_new_with_buffer_provider,