pub struct WindowsParserBorrowed<'a> { /* private fields */ }
Expand description
A borrowed wrapper around the windows time zone mapper data.
Implementations§
Source§impl WindowsParserBorrowed<'static>
impl WindowsParserBorrowed<'static>
Sourcepub fn static_to_owned(&self) -> WindowsParser
pub fn static_to_owned(&self) -> WindowsParser
Cheaply converts a [WindowsParserBorrowed<'static>
] into a WindowsParser
.
Note: Due to branching and indirection, using WindowsParser
might inhibit some
compile-time optimizations that are possible with WindowsParserBorrowed
.
Source§impl WindowsParserBorrowed<'_>
impl WindowsParserBorrowed<'_>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new static WindowsParserBorrowed
.
Sourcepub fn parse(self, windows_tz: &str, region: Option<Region>) -> Option<TimeZone>
pub fn parse(self, windows_tz: &str, region: Option<Region>) -> Option<TimeZone>
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::locale::subtags::region;
use icu::time::{zone::WindowsParser, TimeZone};
use tinystr::tinystr;
let win_tz_mapper = WindowsParser::new();
let bcp47_id = win_tz_mapper.parse("Central Standard Time", None);
assert_eq!(bcp47_id, Some(TimeZone(tinystr!(8, "uschi"))));
let bcp47_id =
win_tz_mapper.parse("Central Standard Time", Some(region!("US")));
assert_eq!(bcp47_id, Some(TimeZone(tinystr!(8, "uschi"))));
let bcp47_id =
win_tz_mapper.parse("Central Standard Time", Some(region!("CA")));
assert_eq!(bcp47_id, Some(TimeZone(tinystr!(8, "cawnp"))));
Sourcepub fn parse_from_utf8(
self,
windows_tz: &[u8],
region: Option<Region>,
) -> Option<TimeZone>
pub fn parse_from_utf8( self, windows_tz: &[u8], region: Option<Region>, ) -> Option<TimeZone>
See Self::parse
.
Trait Implementations§
Source§impl<'a> Clone for WindowsParserBorrowed<'a>
impl<'a> Clone for WindowsParserBorrowed<'a>
Source§fn clone(&self) -> WindowsParserBorrowed<'a>
fn clone(&self) -> WindowsParserBorrowed<'a>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a> Debug for WindowsParserBorrowed<'a>
impl<'a> Debug for WindowsParserBorrowed<'a>
Source§impl Default for WindowsParserBorrowed<'_>
impl Default for WindowsParserBorrowed<'_>
impl<'a> Copy for WindowsParserBorrowed<'a>
Auto Trait Implementations§
impl<'a> Freeze for WindowsParserBorrowed<'a>
impl<'a> RefUnwindSafe for WindowsParserBorrowed<'a>
impl<'a> Send for WindowsParserBorrowed<'a>
impl<'a> Sync for WindowsParserBorrowed<'a>
impl<'a> Unpin for WindowsParserBorrowed<'a>
impl<'a> UnwindSafe for WindowsParserBorrowed<'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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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