pub struct Tz(/* private fields */);Expand description
IANA timezone identifier (e.g. America/New_York, Europe/London).
The validator only inspects the leading path segment (America,
Europe, Asia, …) plus the city when relevant; the wrapper
itself stores the canonical IANA string verbatim so the existing
Intl.DateTimeFormat().resolvedOptions().timeZone output round-trips
without translation.
§Example
use stygian_proxy::ports::coherence::Tz;
let tz = Tz::new("America/New_York").unwrap();
assert_eq!(tz.as_str(), "America/New_York");
assert_eq!(tz.region(), Some("America"));
assert_eq!(tz.city(), Some("New_York"));
assert!(Tz::new("").is_none());Implementations§
Source§impl Tz
impl Tz
Sourcepub fn new(raw: &str) -> Option<Self>
pub fn new(raw: &str) -> Option<Self>
Parse an IANA timezone string. Accepts the canonical
Region/City form and a leading Etc/UTC shortcut. Returns
None when the string is empty.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tz
impl<'de> Deserialize<'de> for Tz
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Tz
impl StructuralPartialEq for Tz
Auto Trait Implementations§
impl Freeze for Tz
impl RefUnwindSafe for Tz
impl Send for Tz
impl Sync for Tz
impl Unpin for Tz
impl UnsafeUnpin for Tz
impl UnwindSafe for Tz
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.