pub struct Day(/* private fields */);Expand description
A day of the month, 1 through 31.
A newtype rather than a bare u8 so that 0 and 47 are not writable, and
so that a record read back from disk is validated on the way in: the serde
representation is the number, parsed through Day::new.
Implementations§
Source§impl Day
impl Day
Sourcepub fn new(day: u8) -> Option<Self>
pub fn new(day: u8) -> Option<Self>
Construct a day of the month, rejecting anything outside 1..=31.
The upper bound is the widest month rather than the right one for a given month and year: this type carries no calendar, and a bound that needed one would be a computation over data the record does not hold.
Trait Implementations§
impl Copy for Day
Source§impl<'de> Deserialize<'de> for Day
impl<'de> Deserialize<'de> for Day
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Day
Source§impl Ord for Day
impl Ord for Day
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Day
impl PartialOrd for Day
impl StructuralPartialEq for Day
Auto Trait Implementations§
impl Freeze for Day
impl RefUnwindSafe for Day
impl Send for Day
impl Sync for Day
impl Unpin for Day
impl UnsafeUnpin for Day
impl UnwindSafe for Day
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.