diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4c35af5..7b1b9e4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -369,3 +369,15 @@ jobs: tool: cargo-hack - run: cargo hack check --version-range 1.36.. --version-step 2 --clean-per-version --clean-per-run + + generate-windows-bindings: + name: Generate windows-core bindings with windows-bindgen + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Clean + run: rm -rf src/Windows.rs + - name: Generate + run: cargo r --manifest-path=api_gen/Cargo.toml + - name: Diff generated Rust code + run: test -z "$(git status --porcelain)" || (echo "::error::Generated files are different, please regenerate with cargo run --manifest-path=api_gen/Cargo.toml!"; git status; false) diff --git a/Cargo.toml b/Cargo.toml index 909d886..cbdc684 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ authors = [ "Andrew Straw ", "René Kijewski ", "Ryan Lopopolo ", - ] +] repository = "https://github.com/strawlab/iana-time-zone" license = "MIT OR Apache-2.0" keywords = ["IANA", "time"] @@ -25,7 +25,7 @@ android_system_properties = "0.1.5" core-foundation-sys = "0.8.3" [target.'cfg(target_os = "windows")'.dependencies] -windows = { version = "0.48.0", features = [ "Globalization" ] } +windows-core = { version = ">=0.50, <=0.51" } [target.'cfg(target_arch = "wasm32")'.dependencies] js-sys = "0.3.50" diff --git a/api_gen/Cargo.toml b/api_gen/Cargo.toml new file mode 100644 index 0000000..250d7de --- /dev/null +++ b/api_gen/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "api_gen" +version = "0.0.0" +edition = "2018" +publish = false + +[dependencies] +windows-bindgen = "0.51" + +# Dissociate this crate from the root workspace to allow older Rust to build the main crate within +# the workspace, without observing `edition = "2021"` inside `windows-bindgen`. +[workspace] diff --git a/api_gen/src/main.rs b/api_gen/src/main.rs new file mode 100644 index 0000000..0e7cc74 --- /dev/null +++ b/api_gen/src/main.rs @@ -0,0 +1,7 @@ +use windows_bindgen::{bindgen, Result}; + +fn main() -> Result<()> { + let log = bindgen(["--etc", "bindings.txt"])?; + println!("{}", log); + Ok(()) +} diff --git a/bindings.txt b/bindings.txt new file mode 100644 index 0000000..fad7e48 --- /dev/null +++ b/bindings.txt @@ -0,0 +1,16 @@ +--out src/Windows.rs + +--filter + Windows.Globalization.Calendar + + # Dependencies of the above + Windows.Foundation.Collections.IIterable + Windows.Foundation.Collections.IIterator + Windows.Foundation.Collections.IVectorView + Windows.Foundation.DateTime + Windows.Foundation.TimeSpan + Windows.Globalization.DayOfWeek + Windows.Globalization.ICalendar + Windows.Globalization.ICalendarFactory + Windows.Globalization.ICalendarFactory2 + Windows.Globalization.ITimeZoneOnCalendar diff --git a/src/Windows.rs b/src/Windows.rs new file mode 100644 index 0000000..ac52f19 --- /dev/null +++ b/src/Windows.rs @@ -0,0 +1,2389 @@ +// Bindings generated by `windows-bindgen` 0.51.1 + +#![allow( + non_snake_case, + non_upper_case_globals, + non_camel_case_types, + dead_code, + clippy::all +)] +pub mod Foundation { + pub mod Collections { + #[repr(transparent)] + pub struct IIterable(::windows_core::IUnknown, ::core::marker::PhantomData) + where + T: ::windows_core::RuntimeType + 'static; + impl IIterable { + pub fn First(&self) -> ::windows_core::Result> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).First)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + } + impl + ::windows_core::CanInto<::windows_core::IUnknown> for IIterable + { + } + impl + ::windows_core::CanInto<::windows_core::IInspectable> for IIterable + { + } + impl ::core::cmp::PartialEq for IIterable { + fn eq(&self, other: &Self) -> bool { + self.0 == other.0 + } + } + impl ::core::cmp::Eq for IIterable {} + impl ::core::fmt::Debug for IIterable { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_tuple("IIterable").field(&self.0).finish() + } + } + impl ::windows_core::RuntimeType for IIterable { + const SIGNATURE: ::windows_core::imp::ConstBuffer = { + ::windows_core::imp::ConstBuffer::new() + .push_slice(b"pinterface(") + .push_slice(b"{faa585ea-6214-4217-afda-7f46de5869b3}") + .push_slice(b";") + .push_other(::SIGNATURE) + .push_slice(b")") + }; + } + impl ::core::iter::IntoIterator for IIterable { + type Item = T; + type IntoIter = IIterator; + fn into_iter(self) -> Self::IntoIter { + ::core::iter::IntoIterator::into_iter(&self) + } + } + impl ::core::iter::IntoIterator for &IIterable { + type Item = T; + type IntoIter = IIterator; + fn into_iter(self) -> Self::IntoIter { + self.First().unwrap() + } + } + unsafe impl ::windows_core::Interface for IIterable { + type Vtable = IIterable_Vtbl; + } + impl ::core::clone::Clone for IIterable { + fn clone(&self) -> Self { + Self(self.0.clone(), ::core::marker::PhantomData::) + } + } + unsafe impl ::windows_core::ComInterface + for IIterable + { + const IID: ::windows_core::GUID = ::windows_core::GUID::from_signature( + ::SIGNATURE, + ); + } + #[repr(C)] + #[doc(hidden)] + pub struct IIterable_Vtbl + where + T: ::windows_core::RuntimeType + 'static, + { + pub base__: ::windows_core::IInspectable_Vtbl, + pub First: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut *mut ::core::ffi::c_void, + ) -> ::windows_core::HRESULT, + pub T: ::core::marker::PhantomData, + } + #[repr(transparent)] + pub struct IIterator(::windows_core::IUnknown, ::core::marker::PhantomData) + where + T: ::windows_core::RuntimeType + 'static; + impl IIterator { + pub fn Current(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Current)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn HasCurrent(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).HasCurrent)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn MoveNext(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).MoveNext)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn GetMany( + &self, + items: &mut [>::Default], + ) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).GetMany)( + ::windows_core::Interface::as_raw(this), + items.len() as u32, + ::core::mem::transmute_copy(&items), + &mut result__, + ) + .from_abi(result__) + } + } + } + impl + ::windows_core::CanInto<::windows_core::IUnknown> for IIterator + { + } + impl + ::windows_core::CanInto<::windows_core::IInspectable> for IIterator + { + } + impl ::core::cmp::PartialEq for IIterator { + fn eq(&self, other: &Self) -> bool { + self.0 == other.0 + } + } + impl ::core::cmp::Eq for IIterator {} + impl ::core::fmt::Debug for IIterator { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_tuple("IIterator").field(&self.0).finish() + } + } + impl ::windows_core::RuntimeType for IIterator { + const SIGNATURE: ::windows_core::imp::ConstBuffer = { + ::windows_core::imp::ConstBuffer::new() + .push_slice(b"pinterface(") + .push_slice(b"{6a79e863-4300-459a-9966-cbb660963ee1}") + .push_slice(b";") + .push_other(::SIGNATURE) + .push_slice(b")") + }; + } + impl ::core::iter::Iterator for IIterator { + type Item = T; + fn next(&mut self) -> ::core::option::Option { + let result = self.Current().ok(); + if result.is_some() { + self.MoveNext().ok()?; + } + result + } + } + unsafe impl ::windows_core::Interface for IIterator { + type Vtable = IIterator_Vtbl; + } + impl ::core::clone::Clone for IIterator { + fn clone(&self) -> Self { + Self(self.0.clone(), ::core::marker::PhantomData::) + } + } + unsafe impl ::windows_core::ComInterface + for IIterator + { + const IID: ::windows_core::GUID = ::windows_core::GUID::from_signature( + ::SIGNATURE, + ); + } + #[repr(C)] + #[doc(hidden)] + pub struct IIterator_Vtbl + where + T: ::windows_core::RuntimeType + 'static, + { + pub base__: ::windows_core::IInspectable_Vtbl, + pub Current: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::windows_core::AbiType, + ) -> ::windows_core::HRESULT, + pub HasCurrent: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut bool, + ) -> ::windows_core::HRESULT, + pub MoveNext: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut bool, + ) -> ::windows_core::HRESULT, + pub GetMany: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + items_array_size: u32, + items: *mut ::windows_core::AbiType, + result__: *mut u32, + ) -> ::windows_core::HRESULT, + pub T: ::core::marker::PhantomData, + } + #[repr(transparent)] + pub struct IVectorView(::windows_core::IUnknown, ::core::marker::PhantomData) + where + T: ::windows_core::RuntimeType + 'static; + impl IVectorView { + pub fn GetAt(&self, index: u32) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).GetAt)( + ::windows_core::Interface::as_raw(this), + index, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn Size(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Size)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn IndexOf(&self, value: P0, index: &mut u32) -> ::windows_core::Result + where + P0: ::windows_core::IntoParam, + { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).IndexOf)( + ::windows_core::Interface::as_raw(this), + value.into_param().abi(), + index, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn GetMany( + &self, + startindex: u32, + items: &mut [>::Default], + ) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).GetMany)( + ::windows_core::Interface::as_raw(this), + startindex, + items.len() as u32, + ::core::mem::transmute_copy(&items), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn First(&self) -> ::windows_core::Result> { + let this = &::windows_core::ComInterface::cast::>(self)?; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).First)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + } + impl + ::windows_core::CanInto<::windows_core::IUnknown> for IVectorView + { + } + impl + ::windows_core::CanInto<::windows_core::IInspectable> for IVectorView + { + } + impl ::windows_core::CanTryInto> + for IVectorView + { + } + impl ::core::cmp::PartialEq for IVectorView { + fn eq(&self, other: &Self) -> bool { + self.0 == other.0 + } + } + impl ::core::cmp::Eq for IVectorView {} + impl ::core::fmt::Debug for IVectorView { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_tuple("IVectorView").field(&self.0).finish() + } + } + impl ::windows_core::RuntimeType for IVectorView { + const SIGNATURE: ::windows_core::imp::ConstBuffer = { + ::windows_core::imp::ConstBuffer::new() + .push_slice(b"pinterface(") + .push_slice(b"{bbe1fa4c-b0e3-4583-baef-1f1b2e483e56}") + .push_slice(b";") + .push_other(::SIGNATURE) + .push_slice(b")") + }; + } + pub struct VectorViewIterator { + vector: ::core::option::Option>, + current: u32, + } + impl VectorViewIterator { + pub fn new(vector: ::core::option::Option>) -> Self { + Self { vector, current: 0 } + } + } + impl ::core::iter::Iterator for VectorViewIterator { + type Item = T; + fn next(&mut self) -> ::core::option::Option { + self.vector + .as_ref() + .and_then(|vector| vector.GetAt(self.current).ok()) + .and_then(|result| { + self.current += 1; + Some(result) + }) + } + } + impl ::core::iter::IntoIterator for IVectorView { + type Item = T; + type IntoIter = VectorViewIterator; + fn into_iter(self) -> Self::IntoIter { + ::core::iter::IntoIterator::into_iter(&self) + } + } + impl ::core::iter::IntoIterator for &IVectorView { + type Item = T; + type IntoIter = VectorViewIterator; + fn into_iter(self) -> Self::IntoIter { + VectorViewIterator::new(::core::option::Option::Some(::core::clone::Clone::clone( + self, + ))) + } + } + unsafe impl ::windows_core::Interface for IVectorView { + type Vtable = IVectorView_Vtbl; + } + impl ::core::clone::Clone for IVectorView { + fn clone(&self) -> Self { + Self(self.0.clone(), ::core::marker::PhantomData::) + } + } + unsafe impl ::windows_core::ComInterface + for IVectorView + { + const IID: ::windows_core::GUID = ::windows_core::GUID::from_signature( + ::SIGNATURE, + ); + } + #[repr(C)] + #[doc(hidden)] + pub struct IVectorView_Vtbl + where + T: ::windows_core::RuntimeType + 'static, + { + pub base__: ::windows_core::IInspectable_Vtbl, + pub GetAt: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + index: u32, + result__: *mut ::windows_core::AbiType, + ) -> ::windows_core::HRESULT, + pub Size: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut u32, + ) -> ::windows_core::HRESULT, + pub IndexOf: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: ::windows_core::AbiType, + index: *mut u32, + result__: *mut bool, + ) -> ::windows_core::HRESULT, + pub GetMany: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + startindex: u32, + items_array_size: u32, + items: *mut ::windows_core::AbiType, + result__: *mut u32, + ) -> ::windows_core::HRESULT, + pub T: ::core::marker::PhantomData, + } + } + #[repr(C)] + pub struct DateTime { + pub UniversalTime: i64, + } + impl ::core::marker::Copy for DateTime {} + impl ::core::clone::Clone for DateTime { + fn clone(&self) -> Self { + *self + } + } + impl ::core::fmt::Debug for DateTime { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("DateTime") + .field("UniversalTime", &self.UniversalTime) + .finish() + } + } + impl ::windows_core::TypeKind for DateTime { + type TypeKind = ::windows_core::CopyType; + } + impl ::windows_core::RuntimeType for DateTime { + const SIGNATURE: ::windows_core::imp::ConstBuffer = + ::windows_core::imp::ConstBuffer::from_slice(b"struct(Windows.Foundation.DateTime;i8)"); + } + impl ::core::cmp::PartialEq for DateTime { + fn eq(&self, other: &Self) -> bool { + self.UniversalTime == other.UniversalTime + } + } + impl ::core::cmp::Eq for DateTime {} + impl ::core::default::Default for DateTime { + fn default() -> Self { + unsafe { ::core::mem::zeroed() } + } + } + #[repr(C)] + pub struct TimeSpan { + pub Duration: i64, + } + impl ::core::marker::Copy for TimeSpan {} + impl ::core::clone::Clone for TimeSpan { + fn clone(&self) -> Self { + *self + } + } + impl ::core::fmt::Debug for TimeSpan { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("TimeSpan") + .field("Duration", &self.Duration) + .finish() + } + } + impl ::windows_core::TypeKind for TimeSpan { + type TypeKind = ::windows_core::CopyType; + } + impl ::windows_core::RuntimeType for TimeSpan { + const SIGNATURE: ::windows_core::imp::ConstBuffer = + ::windows_core::imp::ConstBuffer::from_slice(b"struct(Windows.Foundation.TimeSpan;i8)"); + } + impl ::core::cmp::PartialEq for TimeSpan { + fn eq(&self, other: &Self) -> bool { + self.Duration == other.Duration + } + } + impl ::core::cmp::Eq for TimeSpan {} + impl ::core::default::Default for TimeSpan { + fn default() -> Self { + unsafe { ::core::mem::zeroed() } + } + } + impl ::core::convert::From<::core::time::Duration> for TimeSpan { + fn from(value: ::core::time::Duration) -> Self { + Self { + Duration: (value.as_nanos() / 100) as i64, + } + } + } + impl ::core::convert::From for ::core::time::Duration { + fn from(value: TimeSpan) -> Self { + ::core::time::Duration::from_nanos((value.Duration * 100) as u64) + } + } +} +pub mod Globalization { + #[doc(hidden)] + #[repr(transparent)] + pub struct ICalendar(::windows_core::IUnknown); + unsafe impl ::windows_core::Interface for ICalendar { + type Vtable = ICalendar_Vtbl; + } + impl ::core::clone::Clone for ICalendar { + fn clone(&self) -> Self { + Self(self.0.clone()) + } + } + unsafe impl ::windows_core::ComInterface for ICalendar { + const IID: ::windows_core::GUID = + ::windows_core::GUID::from_u128(0xca30221d_86d9_40fb_a26b_d44eb7cf08ea); + } + #[repr(C)] + #[doc(hidden)] + pub struct ICalendar_Vtbl { + pub base__: ::windows_core::IInspectable_Vtbl, + pub Clone: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut *mut ::core::ffi::c_void, + ) -> ::windows_core::HRESULT, + pub SetToMin: + unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> ::windows_core::HRESULT, + pub SetToMax: + unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> ::windows_core::HRESULT, + pub Languages: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut *mut ::core::ffi::c_void, + ) -> ::windows_core::HRESULT, + pub NumeralSystem: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub SetNumeralSystem: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub GetCalendarSystem: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub ChangeCalendarSystem: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub GetClock: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub ChangeClock: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub GetDateTime: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut super::Foundation::DateTime, + ) -> ::windows_core::HRESULT, + pub SetDateTime: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: super::Foundation::DateTime, + ) -> ::windows_core::HRESULT, + pub SetToNow: + unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> ::windows_core::HRESULT, + pub FirstEra: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub LastEra: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub NumberOfEras: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub Era: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub SetEra: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: i32, + ) -> ::windows_core::HRESULT, + pub AddEras: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + eras: i32, + ) -> ::windows_core::HRESULT, + pub EraAsFullString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub EraAsString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + ideallength: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub FirstYearInThisEra: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub LastYearInThisEra: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub NumberOfYearsInThisEra: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub Year: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub SetYear: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: i32, + ) -> ::windows_core::HRESULT, + pub AddYears: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + years: i32, + ) -> ::windows_core::HRESULT, + pub YearAsString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub YearAsTruncatedString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + remainingdigits: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub YearAsPaddedString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + mindigits: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub FirstMonthInThisYear: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub LastMonthInThisYear: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub NumberOfMonthsInThisYear: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub Month: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub SetMonth: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: i32, + ) -> ::windows_core::HRESULT, + pub AddMonths: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + months: i32, + ) -> ::windows_core::HRESULT, + pub MonthAsFullString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub MonthAsString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + ideallength: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub MonthAsFullSoloString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub MonthAsSoloString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + ideallength: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub MonthAsNumericString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub MonthAsPaddedNumericString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + mindigits: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) + -> ::windows_core::HRESULT, + pub AddWeeks: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + weeks: i32, + ) -> ::windows_core::HRESULT, + pub FirstDayInThisMonth: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub LastDayInThisMonth: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub NumberOfDaysInThisMonth: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub Day: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub SetDay: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: i32, + ) -> ::windows_core::HRESULT, + pub AddDays: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + days: i32, + ) -> ::windows_core::HRESULT, + pub DayAsString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub DayAsPaddedString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + mindigits: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub DayOfWeek: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut DayOfWeek, + ) -> ::windows_core::HRESULT, + pub DayOfWeekAsFullString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub DayOfWeekAsString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + ideallength: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub DayOfWeekAsFullSoloString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) + -> ::windows_core::HRESULT, + pub DayOfWeekAsSoloString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + ideallength: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub FirstPeriodInThisDay: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub LastPeriodInThisDay: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub NumberOfPeriodsInThisDay: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub Period: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub SetPeriod: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: i32, + ) -> ::windows_core::HRESULT, + pub AddPeriods: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + periods: i32, + ) -> ::windows_core::HRESULT, + pub PeriodAsFullString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub PeriodAsString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + ideallength: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub FirstHourInThisPeriod: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub LastHourInThisPeriod: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub NumberOfHoursInThisPeriod: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) + -> ::windows_core::HRESULT, + pub Hour: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub SetHour: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: i32, + ) -> ::windows_core::HRESULT, + pub AddHours: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + hours: i32, + ) -> ::windows_core::HRESULT, + pub HourAsString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub HourAsPaddedString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + mindigits: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub Minute: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub SetMinute: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: i32, + ) -> ::windows_core::HRESULT, + pub AddMinutes: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + minutes: i32, + ) -> ::windows_core::HRESULT, + pub MinuteAsString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub MinuteAsPaddedString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + mindigits: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub Second: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub SetSecond: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: i32, + ) -> ::windows_core::HRESULT, + pub AddSeconds: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + seconds: i32, + ) -> ::windows_core::HRESULT, + pub SecondAsString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub SecondAsPaddedString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + mindigits: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub Nanosecond: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub SetNanosecond: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + value: i32, + ) -> ::windows_core::HRESULT, + pub AddNanoseconds: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + nanoseconds: i32, + ) -> ::windows_core::HRESULT, + pub NanosecondAsString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub NanosecondAsPaddedString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + mindigits: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub Compare: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + other: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub CompareDateTime: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + other: super::Foundation::DateTime, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub CopyTo: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + other: *mut ::core::ffi::c_void, + ) -> ::windows_core::HRESULT, + pub FirstMinuteInThisHour: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub LastMinuteInThisHour: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub NumberOfMinutesInThisHour: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) + -> ::windows_core::HRESULT, + pub FirstSecondInThisMinute: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub LastSecondInThisMinute: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) -> ::windows_core::HRESULT, + pub NumberOfSecondsInThisMinute: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut i32, + ) + -> ::windows_core::HRESULT, + pub ResolvedLanguage: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub IsDaylightSavingTime: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut bool, + ) -> ::windows_core::HRESULT, + } + #[doc(hidden)] + #[repr(transparent)] + pub struct ICalendarFactory(::windows_core::IUnknown); + unsafe impl ::windows_core::Interface for ICalendarFactory { + type Vtable = ICalendarFactory_Vtbl; + } + impl ::core::clone::Clone for ICalendarFactory { + fn clone(&self) -> Self { + Self(self.0.clone()) + } + } + unsafe impl ::windows_core::ComInterface for ICalendarFactory { + const IID: ::windows_core::GUID = + ::windows_core::GUID::from_u128(0x83f58412_e56b_4c75_a66e_0f63d57758a6); + } + #[repr(C)] + #[doc(hidden)] + pub struct ICalendarFactory_Vtbl { + pub base__: ::windows_core::IInspectable_Vtbl, + pub CreateCalendarDefaultCalendarAndClock: + unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + languages: *mut ::core::ffi::c_void, + result__: *mut *mut ::core::ffi::c_void, + ) -> ::windows_core::HRESULT, + pub CreateCalendar: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + languages: *mut ::core::ffi::c_void, + calendar: ::std::mem::MaybeUninit<::windows_core::HSTRING>, + clock: ::std::mem::MaybeUninit<::windows_core::HSTRING>, + result__: *mut *mut ::core::ffi::c_void, + ) -> ::windows_core::HRESULT, + } + #[doc(hidden)] + #[repr(transparent)] + pub struct ICalendarFactory2(::windows_core::IUnknown); + unsafe impl ::windows_core::Interface for ICalendarFactory2 { + type Vtable = ICalendarFactory2_Vtbl; + } + impl ::core::clone::Clone for ICalendarFactory2 { + fn clone(&self) -> Self { + Self(self.0.clone()) + } + } + unsafe impl ::windows_core::ComInterface for ICalendarFactory2 { + const IID: ::windows_core::GUID = + ::windows_core::GUID::from_u128(0xb44b378c_ca7e_4590_9e72_ea2bec1a5115); + } + #[repr(C)] + #[doc(hidden)] + pub struct ICalendarFactory2_Vtbl { + pub base__: ::windows_core::IInspectable_Vtbl, + pub CreateCalendarWithTimeZone: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + languages: *mut ::core::ffi::c_void, + calendar: ::std::mem::MaybeUninit<::windows_core::HSTRING>, + clock: ::std::mem::MaybeUninit<::windows_core::HSTRING>, + timezoneid: ::std::mem::MaybeUninit<::windows_core::HSTRING>, + result__: *mut *mut ::core::ffi::c_void, + ) + -> ::windows_core::HRESULT, + } + #[doc(hidden)] + #[repr(transparent)] + pub struct ITimeZoneOnCalendar(::windows_core::IUnknown); + unsafe impl ::windows_core::Interface for ITimeZoneOnCalendar { + type Vtable = ITimeZoneOnCalendar_Vtbl; + } + impl ::core::clone::Clone for ITimeZoneOnCalendar { + fn clone(&self) -> Self { + Self(self.0.clone()) + } + } + unsafe impl ::windows_core::ComInterface for ITimeZoneOnCalendar { + const IID: ::windows_core::GUID = + ::windows_core::GUID::from_u128(0xbb3c25e5_46cf_4317_a3f5_02621ad54478); + } + #[repr(C)] + #[doc(hidden)] + pub struct ITimeZoneOnCalendar_Vtbl { + pub base__: ::windows_core::IInspectable_Vtbl, + pub GetTimeZone: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub ChangeTimeZone: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + timezoneid: ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub TimeZoneAsFullString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + pub TimeZoneAsString: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + ideallength: i32, + result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, + ) -> ::windows_core::HRESULT, + } + #[repr(transparent)] + pub struct Calendar(::windows_core::IUnknown); + impl Calendar { + pub fn new() -> ::windows_core::Result { + Self::IActivationFactory(|f| f.ActivateInstance::()) + } + fn IActivationFactory< + R, + F: FnOnce(&::windows_core::imp::IGenericFactory) -> ::windows_core::Result, + >( + callback: F, + ) -> ::windows_core::Result { + static SHARED: ::windows_core::imp::FactoryCache< + Calendar, + ::windows_core::imp::IGenericFactory, + > = ::windows_core::imp::FactoryCache::new(); + SHARED.call(callback) + } + pub fn Clone(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Clone)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SetToMin(&self) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetToMin)( + ::windows_core::Interface::as_raw(this), + ) + .ok() + } + } + pub fn SetToMax(&self) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetToMax)( + ::windows_core::Interface::as_raw(this), + ) + .ok() + } + } + pub fn Languages( + &self, + ) -> ::windows_core::Result< + super::Foundation::Collections::IVectorView<::windows_core::HSTRING>, + > { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Languages)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn NumeralSystem(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).NumeralSystem)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SetNumeralSystem( + &self, + value: &::windows_core::HSTRING, + ) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetNumeralSystem)( + ::windows_core::Interface::as_raw(this), + ::core::mem::transmute_copy(value), + ) + .ok() + } + } + pub fn GetCalendarSystem(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).GetCalendarSystem)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn ChangeCalendarSystem( + &self, + value: &::windows_core::HSTRING, + ) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).ChangeCalendarSystem)( + ::windows_core::Interface::as_raw(this), + ::core::mem::transmute_copy(value), + ) + .ok() + } + } + pub fn GetClock(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).GetClock)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn ChangeClock(&self, value: &::windows_core::HSTRING) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).ChangeClock)( + ::windows_core::Interface::as_raw(this), + ::core::mem::transmute_copy(value), + ) + .ok() + } + } + pub fn GetDateTime(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).GetDateTime)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SetDateTime( + &self, + value: super::Foundation::DateTime, + ) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetDateTime)( + ::windows_core::Interface::as_raw(this), + value, + ) + .ok() + } + } + pub fn SetToNow(&self) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetToNow)( + ::windows_core::Interface::as_raw(this), + ) + .ok() + } + } + pub fn FirstEra(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).FirstEra)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn LastEra(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).LastEra)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn NumberOfEras(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).NumberOfEras)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn Era(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Era)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SetEra(&self, value: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetEra)( + ::windows_core::Interface::as_raw(this), + value, + ) + .ok() + } + } + pub fn AddEras(&self, eras: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).AddEras)( + ::windows_core::Interface::as_raw(this), + eras, + ) + .ok() + } + } + pub fn EraAsFullString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).EraAsFullString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn EraAsString( + &self, + ideallength: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).EraAsString)( + ::windows_core::Interface::as_raw(this), + ideallength, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn FirstYearInThisEra(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).FirstYearInThisEra)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn LastYearInThisEra(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).LastYearInThisEra)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn NumberOfYearsInThisEra(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).NumberOfYearsInThisEra)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn Year(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Year)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SetYear(&self, value: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetYear)( + ::windows_core::Interface::as_raw(this), + value, + ) + .ok() + } + } + pub fn AddYears(&self, years: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).AddYears)( + ::windows_core::Interface::as_raw(this), + years, + ) + .ok() + } + } + pub fn YearAsString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).YearAsString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn YearAsTruncatedString( + &self, + remainingdigits: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).YearAsTruncatedString)( + ::windows_core::Interface::as_raw(this), + remainingdigits, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn YearAsPaddedString( + &self, + mindigits: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).YearAsPaddedString)( + ::windows_core::Interface::as_raw(this), + mindigits, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn FirstMonthInThisYear(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).FirstMonthInThisYear)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn LastMonthInThisYear(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).LastMonthInThisYear)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn NumberOfMonthsInThisYear(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).NumberOfMonthsInThisYear)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn Month(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Month)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SetMonth(&self, value: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetMonth)( + ::windows_core::Interface::as_raw(this), + value, + ) + .ok() + } + } + pub fn AddMonths(&self, months: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).AddMonths)( + ::windows_core::Interface::as_raw(this), + months, + ) + .ok() + } + } + pub fn MonthAsFullString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).MonthAsFullString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn MonthAsString( + &self, + ideallength: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).MonthAsString)( + ::windows_core::Interface::as_raw(this), + ideallength, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn MonthAsFullSoloString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).MonthAsFullSoloString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn MonthAsSoloString( + &self, + ideallength: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).MonthAsSoloString)( + ::windows_core::Interface::as_raw(this), + ideallength, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn MonthAsNumericString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).MonthAsNumericString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn MonthAsPaddedNumericString( + &self, + mindigits: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).MonthAsPaddedNumericString)( + ::windows_core::Interface::as_raw(this), + mindigits, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn AddWeeks(&self, weeks: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).AddWeeks)( + ::windows_core::Interface::as_raw(this), + weeks, + ) + .ok() + } + } + pub fn FirstDayInThisMonth(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).FirstDayInThisMonth)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn LastDayInThisMonth(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).LastDayInThisMonth)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn NumberOfDaysInThisMonth(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).NumberOfDaysInThisMonth)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn Day(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Day)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SetDay(&self, value: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetDay)( + ::windows_core::Interface::as_raw(this), + value, + ) + .ok() + } + } + pub fn AddDays(&self, days: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).AddDays)( + ::windows_core::Interface::as_raw(this), + days, + ) + .ok() + } + } + pub fn DayAsString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).DayAsString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn DayAsPaddedString( + &self, + mindigits: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).DayAsPaddedString)( + ::windows_core::Interface::as_raw(this), + mindigits, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn DayOfWeek(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).DayOfWeek)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn DayOfWeekAsFullString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).DayOfWeekAsFullString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn DayOfWeekAsString( + &self, + ideallength: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).DayOfWeekAsString)( + ::windows_core::Interface::as_raw(this), + ideallength, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn DayOfWeekAsFullSoloString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).DayOfWeekAsFullSoloString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn DayOfWeekAsSoloString( + &self, + ideallength: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).DayOfWeekAsSoloString)( + ::windows_core::Interface::as_raw(this), + ideallength, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn FirstPeriodInThisDay(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).FirstPeriodInThisDay)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn LastPeriodInThisDay(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).LastPeriodInThisDay)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn NumberOfPeriodsInThisDay(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).NumberOfPeriodsInThisDay)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn Period(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Period)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SetPeriod(&self, value: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetPeriod)( + ::windows_core::Interface::as_raw(this), + value, + ) + .ok() + } + } + pub fn AddPeriods(&self, periods: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).AddPeriods)( + ::windows_core::Interface::as_raw(this), + periods, + ) + .ok() + } + } + pub fn PeriodAsFullString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).PeriodAsFullString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn PeriodAsString( + &self, + ideallength: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).PeriodAsString)( + ::windows_core::Interface::as_raw(this), + ideallength, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn FirstHourInThisPeriod(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).FirstHourInThisPeriod)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn LastHourInThisPeriod(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).LastHourInThisPeriod)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn NumberOfHoursInThisPeriod(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).NumberOfHoursInThisPeriod)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn Hour(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Hour)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SetHour(&self, value: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetHour)( + ::windows_core::Interface::as_raw(this), + value, + ) + .ok() + } + } + pub fn AddHours(&self, hours: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).AddHours)( + ::windows_core::Interface::as_raw(this), + hours, + ) + .ok() + } + } + pub fn HourAsString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).HourAsString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn HourAsPaddedString( + &self, + mindigits: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).HourAsPaddedString)( + ::windows_core::Interface::as_raw(this), + mindigits, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn Minute(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Minute)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SetMinute(&self, value: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetMinute)( + ::windows_core::Interface::as_raw(this), + value, + ) + .ok() + } + } + pub fn AddMinutes(&self, minutes: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).AddMinutes)( + ::windows_core::Interface::as_raw(this), + minutes, + ) + .ok() + } + } + pub fn MinuteAsString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).MinuteAsString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn MinuteAsPaddedString( + &self, + mindigits: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).MinuteAsPaddedString)( + ::windows_core::Interface::as_raw(this), + mindigits, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn Second(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Second)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SetSecond(&self, value: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetSecond)( + ::windows_core::Interface::as_raw(this), + value, + ) + .ok() + } + } + pub fn AddSeconds(&self, seconds: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).AddSeconds)( + ::windows_core::Interface::as_raw(this), + seconds, + ) + .ok() + } + } + pub fn SecondAsString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).SecondAsString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SecondAsPaddedString( + &self, + mindigits: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).SecondAsPaddedString)( + ::windows_core::Interface::as_raw(this), + mindigits, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn Nanosecond(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Nanosecond)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn SetNanosecond(&self, value: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).SetNanosecond)( + ::windows_core::Interface::as_raw(this), + value, + ) + .ok() + } + } + pub fn AddNanoseconds(&self, nanoseconds: i32) -> ::windows_core::Result<()> { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).AddNanoseconds)( + ::windows_core::Interface::as_raw(this), + nanoseconds, + ) + .ok() + } + } + pub fn NanosecondAsString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).NanosecondAsString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn NanosecondAsPaddedString( + &self, + mindigits: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).NanosecondAsPaddedString)( + ::windows_core::Interface::as_raw(this), + mindigits, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn Compare(&self, other: P0) -> ::windows_core::Result + where + P0: ::windows_core::IntoParam, + { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).Compare)( + ::windows_core::Interface::as_raw(this), + other.into_param().abi(), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn CompareDateTime( + &self, + other: super::Foundation::DateTime, + ) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).CompareDateTime)( + ::windows_core::Interface::as_raw(this), + other, + &mut result__, + ) + .from_abi(result__) + } + } + pub fn CopyTo(&self, other: P0) -> ::windows_core::Result<()> + where + P0: ::windows_core::IntoParam, + { + let this = self; + unsafe { + (::windows_core::Interface::vtable(this).CopyTo)( + ::windows_core::Interface::as_raw(this), + other.into_param().abi(), + ) + .ok() + } + } + pub fn FirstMinuteInThisHour(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).FirstMinuteInThisHour)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn LastMinuteInThisHour(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).LastMinuteInThisHour)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn NumberOfMinutesInThisHour(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).NumberOfMinutesInThisHour)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn FirstSecondInThisMinute(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).FirstSecondInThisMinute)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn LastSecondInThisMinute(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).LastSecondInThisMinute)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn NumberOfSecondsInThisMinute(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).NumberOfSecondsInThisMinute)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn ResolvedLanguage(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).ResolvedLanguage)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn IsDaylightSavingTime(&self) -> ::windows_core::Result { + let this = self; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).IsDaylightSavingTime)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn CreateCalendarDefaultCalendarAndClock( + languages: P0, + ) -> ::windows_core::Result + where + P0: ::windows_core::TryIntoParam< + super::Foundation::Collections::IIterable<::windows_core::HSTRING>, + >, + { + Self::ICalendarFactory(|this| unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).CreateCalendarDefaultCalendarAndClock)( + ::windows_core::Interface::as_raw(this), + languages.try_into_param()?.abi(), + &mut result__, + ) + .from_abi(result__) + }) + } + pub fn CreateCalendar( + languages: P0, + calendar: &::windows_core::HSTRING, + clock: &::windows_core::HSTRING, + ) -> ::windows_core::Result + where + P0: ::windows_core::TryIntoParam< + super::Foundation::Collections::IIterable<::windows_core::HSTRING>, + >, + { + Self::ICalendarFactory(|this| unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).CreateCalendar)( + ::windows_core::Interface::as_raw(this), + languages.try_into_param()?.abi(), + ::core::mem::transmute_copy(calendar), + ::core::mem::transmute_copy(clock), + &mut result__, + ) + .from_abi(result__) + }) + } + pub fn CreateCalendarWithTimeZone( + languages: P0, + calendar: &::windows_core::HSTRING, + clock: &::windows_core::HSTRING, + timezoneid: &::windows_core::HSTRING, + ) -> ::windows_core::Result + where + P0: ::windows_core::TryIntoParam< + super::Foundation::Collections::IIterable<::windows_core::HSTRING>, + >, + { + Self::ICalendarFactory2(|this| unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).CreateCalendarWithTimeZone)( + ::windows_core::Interface::as_raw(this), + languages.try_into_param()?.abi(), + ::core::mem::transmute_copy(calendar), + ::core::mem::transmute_copy(clock), + ::core::mem::transmute_copy(timezoneid), + &mut result__, + ) + .from_abi(result__) + }) + } + pub fn GetTimeZone(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = &::windows_core::ComInterface::cast::(self)?; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).GetTimeZone)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn ChangeTimeZone( + &self, + timezoneid: &::windows_core::HSTRING, + ) -> ::windows_core::Result<()> { + let this = &::windows_core::ComInterface::cast::(self)?; + unsafe { + (::windows_core::Interface::vtable(this).ChangeTimeZone)( + ::windows_core::Interface::as_raw(this), + ::core::mem::transmute_copy(timezoneid), + ) + .ok() + } + } + pub fn TimeZoneAsFullString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = &::windows_core::ComInterface::cast::(self)?; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).TimeZoneAsFullString)( + ::windows_core::Interface::as_raw(this), + &mut result__, + ) + .from_abi(result__) + } + } + pub fn TimeZoneAsString( + &self, + ideallength: i32, + ) -> ::windows_core::Result<::windows_core::HSTRING> { + let this = &::windows_core::ComInterface::cast::(self)?; + unsafe { + let mut result__ = ::std::mem::zeroed(); + (::windows_core::Interface::vtable(this).TimeZoneAsString)( + ::windows_core::Interface::as_raw(this), + ideallength, + &mut result__, + ) + .from_abi(result__) + } + } + #[doc(hidden)] + pub fn ICalendarFactory ::windows_core::Result>( + callback: F, + ) -> ::windows_core::Result { + static SHARED: ::windows_core::imp::FactoryCache = + ::windows_core::imp::FactoryCache::new(); + SHARED.call(callback) + } + #[doc(hidden)] + pub fn ICalendarFactory2 ::windows_core::Result>( + callback: F, + ) -> ::windows_core::Result { + static SHARED: ::windows_core::imp::FactoryCache = + ::windows_core::imp::FactoryCache::new(); + SHARED.call(callback) + } + } + impl ::core::cmp::PartialEq for Calendar { + fn eq(&self, other: &Self) -> bool { + self.0 == other.0 + } + } + impl ::core::cmp::Eq for Calendar {} + impl ::core::fmt::Debug for Calendar { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_tuple("Calendar").field(&self.0).finish() + } + } + impl ::windows_core::RuntimeType for Calendar { + const SIGNATURE: ::windows_core::imp::ConstBuffer = + ::windows_core::imp::ConstBuffer::from_slice( + b"rc(Windows.Globalization.Calendar;{ca30221d-86d9-40fb-a26b-d44eb7cf08ea})", + ); + } + impl ::core::clone::Clone for Calendar { + fn clone(&self) -> Self { + Self(self.0.clone()) + } + } + unsafe impl ::windows_core::Interface for Calendar { + type Vtable = ICalendar_Vtbl; + } + unsafe impl ::windows_core::ComInterface for Calendar { + const IID: ::windows_core::GUID = ::IID; + } + impl ::windows_core::RuntimeName for Calendar { + const NAME: &'static str = "Windows.Globalization.Calendar"; + } + ::windows_core::imp::interface_hierarchy!( + Calendar, + ::windows_core::IUnknown, + ::windows_core::IInspectable + ); + unsafe impl ::core::marker::Send for Calendar {} + unsafe impl ::core::marker::Sync for Calendar {} + #[repr(transparent)] + #[derive(::core::cmp::PartialEq, ::core::cmp::Eq)] + pub struct DayOfWeek(pub i32); + impl DayOfWeek { + pub const Sunday: Self = Self(0i32); + pub const Monday: Self = Self(1i32); + pub const Tuesday: Self = Self(2i32); + pub const Wednesday: Self = Self(3i32); + pub const Thursday: Self = Self(4i32); + pub const Friday: Self = Self(5i32); + pub const Saturday: Self = Self(6i32); + } + impl ::core::marker::Copy for DayOfWeek {} + impl ::core::clone::Clone for DayOfWeek { + fn clone(&self) -> Self { + *self + } + } + impl ::core::default::Default for DayOfWeek { + fn default() -> Self { + Self(0) + } + } + impl ::windows_core::TypeKind for DayOfWeek { + type TypeKind = ::windows_core::CopyType; + } + impl ::core::fmt::Debug for DayOfWeek { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_tuple("DayOfWeek").field(&self.0).finish() + } + } + impl ::windows_core::RuntimeType for DayOfWeek { + const SIGNATURE: ::windows_core::imp::ConstBuffer = + ::windows_core::imp::ConstBuffer::from_slice( + b"enum(Windows.Globalization.DayOfWeek;i4)", + ); + } +} diff --git a/src/tz_windows.rs b/src/tz_windows.rs index eaa5d5a..0efca89 100644 --- a/src/tz_windows.rs +++ b/src/tz_windows.rs @@ -1,7 +1,11 @@ +#[path = "Windows.rs"] +#[allow(missing_debug_implementations, clippy::undocumented_unsafe_blocks)] +mod windows; + use windows::Globalization::Calendar; -impl From for crate::GetTimezoneError { - fn from(orig: windows::core::Error) -> Self { +impl From for crate::GetTimezoneError { + fn from(orig: windows_core::Error) -> Self { crate::GetTimezoneError::IoError(std::io::Error::new(std::io::ErrorKind::Other, orig)) } }