Struct NaiveWeek
pub struct NaiveWeek { /* private fields */ }
A week represented by a NaiveDate and a Weekday which is the first
day of the week.
Implementations
impl NaiveWeek
const fn first_day(&self) -> NaiveDateReturns a date representing the first day of the week.
Panics
Panics if the first day of the week happens to fall just out of range of
NaiveDate(more than ca. 262,000 years away from common era).Examples
use ; let date = from_ymd_opt.unwrap; let week = date.week; assert!;const fn checked_first_day(&self) -> Option<NaiveDate>Returns a date representing the first day of the week or
Noneif the date is out ofNaiveDate's range (more than ca. 262,000 years away from common era).Examples
use ; let date = MIN; let week = date.week; if let Some = week.checked_first_day else ;const fn last_day(&self) -> NaiveDateReturns a date representing the last day of the week.
Panics
Panics if the last day of the week happens to fall just out of range of
NaiveDate(more than ca. 262,000 years away from common era).Examples
use ; let date = from_ymd_opt.unwrap; let week = date.week; assert!;const fn checked_last_day(&self) -> Option<NaiveDate>Returns a date representing the last day of the week or
Noneif the date is out ofNaiveDate's range (more than ca. 262,000 years away from common era).Examples
use ; let date = MAX; let week = date.week; if let Some = week.checked_last_day else ;const fn days(&self) -> RangeInclusive<NaiveDate>Returns a [
RangeInclusive<T>] representing the whole week bounded by first_day and last_day functions.Panics
Panics if the either the first or last day of the week happens to fall just out of range of
NaiveDate(more than ca. 262,000 years away from common era).Examples
use ; let date = from_ymd_opt.unwrap; let week = date.week; let days = week.days; assert!;const fn checked_days(&self) -> Option<RangeInclusive<NaiveDate>>Returns an [
Option<RangeInclusive<T>>] representing the whole week bounded by checked_first_day and checked_last_day functions.Returns
Noneif either of the boundaries are out ofNaiveDate's range (more than ca. 262,000 years away from common era).Examples
use ; let date = MAX; let week = date.week; let _days = match week.checked_days ;
Trait Implementations
impl Clone for NaiveWeek
fn clone(&self) -> Self
impl Copy for NaiveWeek
impl Debug for NaiveWeek
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for NaiveWeek
impl Hash for NaiveWeek
fn hash<H: Hasher>(&self, state: &mut H)
impl PartialEq for NaiveWeek
fn eq(&self, other: &Self) -> bool
Auto Trait Implementations
impl Freeze for NaiveWeek
impl RefUnwindSafe for NaiveWeek
impl Send for NaiveWeek
impl Sync for NaiveWeek
impl Unpin for NaiveWeek
impl UnsafeUnpin for NaiveWeek
impl UnwindSafe for NaiveWeek
Blanket Implementations
impl<T> Any for NaiveWeek
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for NaiveWeek
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for NaiveWeek
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for NaiveWeek
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for NaiveWeek
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for NaiveWeek
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for NaiveWeek
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for NaiveWeek
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for NaiveWeek
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>