Lines Matching +full:rkyv +full:- +full:validation
3 #[cfg(any(feature = "rkyv", feature = "rkyv-16", feature = "rkyv-32", feature = "rkyv-64"))]
4 use rkyv::{Archive, Deserialize, Serialize};
17 /// // `2019-10-28T09:10:11Z`
28 /// Allows mapping from and to month, from 1-January to 12-December.
30 // Actual implementation is zero-indexed, API intended as 1-indexed for more intuitive behavior.
32 #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
34 any(feature = "rkyv", feature = "rkyv-16", feature = "rkyv-32", feature = "rkyv-64"),
39 #[cfg_attr(feature = "rkyv-validation", archive(check_bytes))]
72 /// ----------- | --------- | ---------- | --- | ---------
76 pub const fn succ(&self) -> Month { in succ()
96 /// ----------- | --------- | ---------- | --- | ---------
100 pub const fn pred(&self) -> Month { in pred()
117 /// Returns a month-of-year number starting from January = 1.
120 /// -------------------------| --------- | ---------- | --- | -----
124 pub const fn number_from_month(&self) -> u32 { in number_from_month()
149 pub const fn name(&self) -> &'static str { in name()
170 fn try_from(value: u8) -> Result<Self, Self::Error> { in try_from()
190 /// Returns an `Option<Month>` from a i64, assuming a 1-index, January = 1.
193 /// ---------------------------| -------------------- | --------------------- | ... | -----
197 fn from_u64(n: u64) -> Option<Month> { in from_u64()
202 fn from_i64(n: i64) -> Option<Month> { in from_i64()
207 fn from_u32(n: u32) -> Option<Month> { in from_u32()
233 pub const fn new(num: u32) -> Self { in new()
239 pub const fn as_u32(&self) -> u32 { in as_u32()
254 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { in fmt()
260 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { in fmt()
273 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> in serialize()
286 fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result { in expecting()
290 fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> in visit_str()
294 value.parse().map_err(|_| E::custom("short (3-letter) or full month names expected")) in visit_str()
299 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> in deserialize()
437 #[cfg(feature = "rkyv-validation")]
440 let bytes = rkyv::to_bytes::<_, 1>(&month).unwrap(); in test_rkyv_validation()
441 assert_eq!(rkyv::from_bytes::<Month>(&bytes).unwrap(), month); in test_rkyv_validation()