Struct TimeZoneSettings

Source
pub struct TimeZoneSettings<'a> { /* private fields */ }
Available on crate feature alloc only.
Expand description

Time zone settings

Implementations§

Source§

impl<'a> TimeZoneSettings<'a>

Source

pub const DEFAULT_DIRECTORIES: &'static [&'static str]

Default possible system timezone directories

Source

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)>>}

Available on crate feature std only.

Default read file function

Source

pub const DEFAULT: TimeZoneSettings<'static>

Available on crate feature std only.

Default time zone settings

Source

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

Source

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.

Source

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§

Source§

impl<'a> Debug for TimeZoneSettings<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.