Struct icu::timezone::WindowsTimeZoneMapperBorrowed
source · pub struct WindowsTimeZoneMapperBorrowed<'a> { /* private fields */ }
Expand description
A borrowed wrapper around the windows time zone mapper data.
Implementations§
source§impl WindowsTimeZoneMapperBorrowed<'_>
impl WindowsTimeZoneMapperBorrowed<'_>
sourcepub fn new() -> WindowsTimeZoneMapperBorrowed<'_>
pub fn new() -> WindowsTimeZoneMapperBorrowed<'_>
Creates a new static WindowsTimeZoneMapperBorrowed
.
sourcepub fn windows_tz_to_bcp47_id(
&self,
windows_tz: &str,
region: Option<Region>,
) -> Option<TimeZoneBcp47Id>
pub fn windows_tz_to_bcp47_id( &self, windows_tz: &str, region: Option<Region>, ) -> Option<TimeZoneBcp47Id>
Returns the BCP-47 ID for a provided Windows time zone and Region
with a case sensitive query.
If no region is provided or the specificity is not required,
then the territory will default to the M.49 World Code, 001
.
use icu::timezone::{WindowsTimeZoneMapper, TimeZoneBcp47Id};
use icu::locale::subtags::region;
use tinystr::tinystr;
let win_tz_mapper = WindowsTimeZoneMapper::new();
let bcp47_id = win_tz_mapper.windows_tz_to_bcp47_id("Central Standard Time", None);
assert_eq!(bcp47_id, Some(TimeZoneBcp47Id(tinystr!(8, "uschi"))));
let bcp47_id = win_tz_mapper.windows_tz_to_bcp47_id("Central Standard Time", Some(region!("US")));
assert_eq!(bcp47_id, Some(TimeZoneBcp47Id(tinystr!(8, "uschi"))));
let bcp47_id = win_tz_mapper.windows_tz_to_bcp47_id("Central Standard Time", Some(region!("CA")));
assert_eq!(bcp47_id, Some(TimeZoneBcp47Id(tinystr!(8, "cawnp"))));
Trait Implementations§
source§impl<'a> Debug for WindowsTimeZoneMapperBorrowed<'a>
impl<'a> Debug for WindowsTimeZoneMapperBorrowed<'a>
source§impl Default for WindowsTimeZoneMapperBorrowed<'_>
impl Default for WindowsTimeZoneMapperBorrowed<'_>
source§fn default() -> WindowsTimeZoneMapperBorrowed<'_>
fn default() -> WindowsTimeZoneMapperBorrowed<'_>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for WindowsTimeZoneMapperBorrowed<'a>
impl<'a> RefUnwindSafe for WindowsTimeZoneMapperBorrowed<'a>
impl<'a> Send for WindowsTimeZoneMapperBorrowed<'a>
impl<'a> Sync for WindowsTimeZoneMapperBorrowed<'a>
impl<'a> Unpin for WindowsTimeZoneMapperBorrowed<'a>
impl<'a> UnwindSafe for WindowsTimeZoneMapperBorrowed<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more