pub struct TimeZoneLocation { /* private fields */ }Expand description
The geographical location corresponding to a primary time zone identifier.
This can be retrieved for a time zone via TimeZone::location.
§Example
use jiff::tz::TimeZone;
let tz = TimeZone::get("Europe/Copenhagen")?;
let loc = tz.location().unwrap();
assert_eq!(loc.country(), "DK");
let tz = TimeZone::get("EuRoPe/BeRlIn")?;
let loc = tz.location().unwrap();
assert_eq!(loc.country(), "DE");
let tz = TimeZone::get("asia/calcutta")?;
let loc = tz.location().unwrap();
assert_eq!(loc.country(), "IN");
Implementations§
Source§impl TimeZoneLocation
impl TimeZoneLocation
Sourcepub const fn country(&self) -> &str
pub const fn country(&self) -> &str
Returns the ISO 3166 country code for the corresponding time zone.
§Example
use jiff::tz::TimeZone;
let tz = TimeZone::get("Asia/Calcutta")?;
let loc = tz.location().unwrap();
assert_eq!(loc.country(), "IN");
Trait Implementations§
Source§impl Clone for TimeZoneLocation
impl Clone for TimeZoneLocation
impl Copy for TimeZoneLocation
Auto Trait Implementations§
impl Forget for TimeZoneLocation
impl Freeze for TimeZoneLocation
impl Move for TimeZoneLocation
impl RefUnwindSafe for TimeZoneLocation
impl Send for TimeZoneLocation
impl Sync for TimeZoneLocation
impl Unpin for TimeZoneLocation
impl UnsafeUnpin for TimeZoneLocation
impl UnwindSafe for TimeZoneLocation
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