Struct IsoWeek

struct IsoWeek { ... }

ISO 8601 week.

This type, combined with Weekday, constitutes the ISO 8601 week date. One can retrieve this type from the existing Datelike types via the Datelike::iso_week method.

Implementations

impl IsoWeek

const fn year(self: &Self) -> i32

Returns the year number for this ISO week.

Example

use chrono::{Datelike, NaiveDate, Weekday};

let d = NaiveDate::from_isoywd_opt(2015, 1, Weekday::Mon).unwrap();
assert_eq!(d.iso_week().year(), 2015);

This year number might not match the calendar year number. Continuing the example...

# use chrono::{NaiveDate, Datelike, Weekday};
# let d = NaiveDate::from_isoywd_opt(2015, 1, Weekday::Mon).unwrap();
assert_eq!(d.year(), 2014);
assert_eq!(d, NaiveDate::from_ymd_opt(2014, 12, 29).unwrap());
const fn week(self: &Self) -> u32

Returns the ISO week number starting from 1.

The return value ranges from 1 to 53. (The last week of year differs by years.)

Example

use chrono::{Datelike, NaiveDate, Weekday};

let d = NaiveDate::from_isoywd_opt(2015, 15, Weekday::Mon).unwrap();
assert_eq!(d.iso_week().week(), 15);
const fn week0(self: &Self) -> u32

Returns the ISO week number starting from 0.

The return value ranges from 0 to 52. (The last week of year differs by years.)

Example

use chrono::{Datelike, NaiveDate, Weekday};

let d = NaiveDate::from_isoywd_opt(2015, 15, Weekday::Mon).unwrap();
assert_eq!(d.iso_week().week0(), 14);

impl Clone for IsoWeek

fn clone(self: &Self) -> IsoWeek

impl Copy for IsoWeek

impl Debug for IsoWeek

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Eq for IsoWeek

impl Freeze for IsoWeek

impl Hash for IsoWeek

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl Ord for IsoWeek

fn cmp(self: &Self, other: &IsoWeek) -> Ordering

impl PartialEq for IsoWeek

fn eq(self: &Self, other: &IsoWeek) -> bool

impl PartialOrd for IsoWeek

fn partial_cmp(self: &Self, other: &IsoWeek) -> Option<Ordering>

impl RefUnwindSafe for IsoWeek

impl Send for IsoWeek

impl StructuralPartialEq for IsoWeek

impl Sync for IsoWeek

impl Unpin for IsoWeek

impl UnsafeUnpin for IsoWeek

impl UnwindSafe for IsoWeek

impl<T> Any for IsoWeek

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for IsoWeek

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for IsoWeek

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for IsoWeek

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for IsoWeek

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for IsoWeek

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for IsoWeek

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for IsoWeek

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for IsoWeek

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>