Bug 1869647 - Mark hasStorageAccess.sub.https.window.html as intermittent after wpt...
[gecko.git] / intl / icu_capi / src / metazone_calculator.rs
blobe55ede26bd334d2d1af656fd0a5a328274b096b4
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 ).
5 #[diplomat::bridge]
6 pub mod ffi {
7     use crate::errors::ffi::ICU4XError;
8     use crate::provider::ffi::ICU4XDataProvider;
9     use alloc::boxed::Box;
10     use icu_timezone::MetazoneCalculator;
12     /// An object capable of computing the metazone from a timezone.
13     ///
14     /// This can be used via `maybe_calculate_metazone()` on [`ICU4XCustomTimeZone`].
15     ///
16     /// [`ICU4XCustomTimeZone`]: crate::timezone::ffi::ICU4XCustomTimeZone
17     #[diplomat::opaque]
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)]
23         pub fn create(
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,
30                 provider,
31             )?)))
32         }
33     }