cftime_rs/datetimes/
traits.rs1use crate::{calendars::Calendar, timezone::Tz};
2
3pub trait IsLeap {
4 fn is_leap(year: i64) -> bool;
5}
6
7pub trait CalendarDatetime {
8 fn ymd_hms(&self) -> Result<(i64, u8, u8, u8, u8, u8), crate::errors::Error>;
9 fn timestamp(&self) -> i64;
10 fn nanoseconds(&self) -> u32;
11 fn timezone(&self) -> Tz;
12 fn calendar(&self) -> Calendar;
13}
14pub trait CalendarDatetimeCreator
15where
16 Self: Sized,
17{
18 fn from_ymd_hms(
19 year: i64,
20 month: u8,
21 day: u8,
22 hour: u8,
23 minute: u8,
24 second: f32,
25 ) -> Result<Self, crate::errors::Error>;
26 fn from_timestamp(timestamp: i64, nanoseconds: u32) -> Self;
27}