• Home
  • Raw
  • Download

Lines Matching +full:rkyv +full:- +full:validation

10 #[cfg(any(feature = "rkyv", feature = "rkyv-16", feature = "rkyv-32", feature = "rkyv-64"))]
11 use rkyv::{Archive, Deserialize, Serialize};
16 /// constitutes the ISO 8601 [week date](./struct.NaiveDate.html#week-date).
21 any(feature = "rkyv", feature = "rkyv-16", feature = "rkyv-32", feature = "rkyv-64"),
26 #[cfg_attr(feature = "rkyv-validation", archive(check_bytes))]
40 pub(super) fn iso_week_from_yof(year: i32, of: Of) -> IsoWeek { in iso_week_from_yof()
44 let prevlastweek = YearFlags::from_year(year - 1).nisoweeks(); in iso_week_from_yof()
45 (year - 1, prevlastweek) in iso_week_from_yof()
81 pub const fn year(&self) -> i32 { in year()
98 pub const fn week(&self) -> u32 { in week()
115 pub const fn week0(&self) -> u32 { in week0()
116 ((self.ywf >> 4) & 0x3f) as u32 - 1 in week0()
121 /// [`d.format("%G-W%V")`](../format/strftime/index.html)
129 /// assert_eq!(format!("{:?}", NaiveDate::from_ymd_opt(2015, 9, 5).unwrap().iso_week()), "2015-W3…
130 /// assert_eq!(format!("{:?}", NaiveDate::from_ymd_opt( 0, 1, 3).unwrap().iso_week()), "0000-W0…
131 /// assert_eq!(format!("{:?}", NaiveDate::from_ymd_opt(9999, 12, 31).unwrap().iso_week()), "9999-W5…
138 …ert_eq!(format!("{:?}", NaiveDate::from_ymd_opt( 0, 1, 2).unwrap().iso_week()), "-0001-W52");
139 …ert_eq!(format!("{:?}", NaiveDate::from_ymd_opt(10000, 12, 31).unwrap().iso_week()), "+10000-W52");
142 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { in fmt()
146 write!(f, "{:04}-W{:02}", year, week) in fmt()
148 // ISO 8601 requires the explicit sign for out-of-range years in fmt()
149 write!(f, "{:+05}-W{:02}", year, week) in fmt()
156 #[cfg(feature = "rkyv-validation")]
170 assert_eq!(format!("{:?}", minweek), NaiveDate::MIN.format("%G-W%V").to_string()); in test_iso_week_extremes()
176 assert_eq!(format!("{:?}", maxweek), NaiveDate::MAX.format("%G-W%V").to_string()); in test_iso_week_extremes()
214 #[cfg(feature = "rkyv-validation")]
217 let bytes = rkyv::to_bytes::<_, 4>(&minweek).unwrap(); in test_rkyv_validation()
218 assert_eq!(rkyv::from_bytes::<IsoWeek>(&bytes).unwrap(), minweek); in test_rkyv_validation()
221 let bytes = rkyv::to_bytes::<_, 4>(&maxweek).unwrap(); in test_rkyv_validation()
222 assert_eq!(rkyv::from_bytes::<IsoWeek>(&bytes).unwrap(), maxweek); in test_rkyv_validation()