use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
pub struct DateTimeJson {
abbreviation: String,
client_ip: String,
datetime: String,
day_of_week: i64,
day_of_year: i64,
dst: bool,
dst_from: Option<DateTime<Utc>>,
dst_offset: i64,
dst_until: Option<DateTime<Utc>>,
raw_offset: i64,
timezone: String,
unixtime: i64,
utc_datetime: DateTime<Utc>,
utc_offset: String,
week_number: i64,
}
impl DateTimeJson {
#[must_use]
pub fn key_list() -> Vec<&'static str> {
vec![
"abbreviation",
"client_ip",
"datetime",
"day_of_week",
"day_of_year",
"dst",
"dst_from",
"dst_offset",
"dst_until",
"raw_offset",
"timezone",
"unixtime",
"utc_datetime",
"utc_offset",
"week_number",
]
}
#[must_use]
pub fn abbreviation(&self) -> &str {
&self.abbreviation
}
#[must_use]
pub fn client_ip(&self) -> &str {
&self.client_ip
}
#[must_use]
pub fn datetime(&self) -> &str {
&self.datetime
}
#[must_use]
pub const fn day_of_week(&self) -> i64 {
self.day_of_week
}
#[must_use]
pub const fn day_of_year(&self) -> i64 {
self.day_of_year
}
#[must_use]
pub const fn dst(&self) -> bool {
self.dst
}
#[must_use]
pub const fn dst_from(&self) -> Option<DateTime<Utc>> {
self.dst_from
}
#[must_use]
pub const fn dst_offset(&self) -> i64 {
self.dst_offset
}
#[must_use]
pub const fn dst_until(&self) -> Option<DateTime<Utc>> {
self.dst_until
}
#[must_use]
pub const fn raw_offset(&self) -> i64 {
self.raw_offset
}
#[must_use]
pub fn timezone(&self) -> &str {
&self.timezone
}
#[must_use]
pub const fn unixtime(&self) -> i64 {
self.unixtime
}
#[must_use]
pub const fn utc_datetime(&self) -> DateTime<Utc> {
self.utc_datetime
}
#[must_use]
pub fn utc_offset(&self) -> &str {
&self.utc_offset
}
#[must_use]
pub const fn week_number(&self) -> i64 {
self.week_number
}
}