pub struct TimeZoneSettings<'a> { /* private fields */ }
Available on crate feature
alloc
only.Expand description
Time zone settings
Implementations§
Source§impl<'a> TimeZoneSettings<'a>
impl<'a> TimeZoneSettings<'a>
Sourcepub const DEFAULT_DIRECTORIES: &'static [&'static str]
pub const DEFAULT_DIRECTORIES: &'static [&'static str]
Default possible system timezone directories
Sourcepub const DEFAULT_READ_FILE_FN: fn(path: &str) -> Result<Vec<u8>, Box<dyn Error + Send + Sync + 'static>> = {<{closure@/home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tz-rs-0.7.0/src/timezone/mod.rs:545:50: 545:56} as std::ops::FnOnce<(&str,)>>::call_once as for<'a> fn(&'a str) -> std::result::Result<std::vec::Vec<u8>, std::boxed::Box<(dyn std::error::Error + std::marker::Send + std::marker::Sync + 'static)>>}
Available on crate feature std
only.
pub const DEFAULT_READ_FILE_FN: fn(path: &str) -> Result<Vec<u8>, Box<dyn Error + Send + Sync + 'static>> = {<{closure@/home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tz-rs-0.7.0/src/timezone/mod.rs:545:50: 545:56} as std::ops::FnOnce<(&str,)>>::call_once as for<'a> fn(&'a str) -> std::result::Result<std::vec::Vec<u8>, std::boxed::Box<(dyn std::error::Error + std::marker::Send + std::marker::Sync + 'static)>>}
std
only.Default read file function
Sourcepub const DEFAULT: TimeZoneSettings<'static>
Available on crate feature std
only.
pub const DEFAULT: TimeZoneSettings<'static>
std
only.Default time zone settings
Sourcepub const fn new(
directories: &'a [&'a str],
read_file_fn: fn(path: &str) -> Result<Vec<u8>, Box<dyn Error + Send + Sync + 'static>>,
) -> TimeZoneSettings<'a>
pub const fn new( directories: &'a [&'a str], read_file_fn: fn(path: &str) -> Result<Vec<u8>, Box<dyn Error + Send + Sync + 'static>>, ) -> TimeZoneSettings<'a>
Construct time zone settings
Sourcepub fn parse_local(&self) -> Result<TimeZone, Error>
pub fn parse_local(&self) -> Result<TimeZone, Error>
Returns local time zone using current settings.
This method in not supported on non-UNIX platforms, and returns the UTC time zone instead.
Sourcepub fn parse_posix_tz(&self, tz_string: &str) -> Result<TimeZone, Error>
pub fn parse_posix_tz(&self, tz_string: &str) -> Result<TimeZone, Error>
Construct a time zone from a POSIX TZ string using current settings,
as described in the POSIX documentation of the TZ
environment variable.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for TimeZoneSettings<'a>
impl<'a> RefUnwindSafe for TimeZoneSettings<'a>
impl<'a> Send for TimeZoneSettings<'a>
impl<'a> Sync for TimeZoneSettings<'a>
impl<'a> Unpin for TimeZoneSettings<'a>
impl<'a> UnwindSafe for TimeZoneSettings<'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