libtad_models/time/
dstentry.rs

1use super::{TimeChange, TimeZone};
2use crate::places::Region;
3use serde::Deserialize;
4
5#[derive(Deserialize)]
6/// DST information about a region.
7pub struct DSTEntry {
8    /// The geographical region where this information is valid.
9    /// Contains country, a textual description of the region and the name of the biggest place.
10    pub region: Region,
11
12    /// Information about the standard time zone.
13    pub stdtimezone: TimeZone,
14
15    /// Information about the daylight savings time zone. Please note that if the region is on
16    /// daylight savings time for the whole year, this information will be returned in the
17    /// stdtimezone element. Additionally, the special element will be set to allyear.
18    pub dsttimezone: Option<TimeZone>,
19
20    /// Indicates if the region does not observe DST at all, or is on DST all year long.
21    pub special: Option<DSTEntrySpecial>,
22
23    /// Starting date of daylight savings time.
24    pub dststart: Option<String>,
25
26    /// Ending date of daylight savings time.
27    pub dstend: Option<String>,
28
29    /// Time changes (daylight savings time).
30    pub timechanges: Option<Vec<TimeChange>>,
31}
32
33#[derive(Deserialize)]
34/// Indicates if the region does not observe DST at all, or is on DST all year long.
35pub struct DSTEntrySpecial {
36    /// The type of digression.
37    pub r#type: DSTEntrySpecialType,
38}
39
40#[derive(Deserialize)]
41#[serde(rename_all = "lowercase")]
42/// Special type of DST observation.
43pub enum DSTEntrySpecialType {
44    /// DST is not observed at all.
45    NoDST,
46
47    /// DST is observed all year.
48    AllYear,
49}