[−][src]Struct gregorian::Year
A calendar year.
All dates in the library use the proleptic Gregorian calendar with a year 0.
Implementations
impl Year
[src]
pub const fn new(year: i16) -> Self
[src]
Create a new year from a number.
pub const fn to_number(self) -> i16
[src]
Get the year number.
pub const fn has_leap_day(self) -> bool
[src]
Check if the year has a leap day.
In the proleptic Gregorian calendar with a year 0, the year 0 has a leap day.
pub const fn total_days(self) -> u16
[src]
Get the total number of days in the year.
For leap years, this is 366. For other years, this is 365.
pub const fn next(self) -> Self
[src]
Get the next year.
pub const fn prev(self) -> Self
[src]
Get the previous year.
pub const fn with_month(self, month: Month) -> YearMonth
[src]
Combine the year with a month to create a YearMonth
.
pub const fn with_day_of_year(
self,
day_of_year: u16
) -> Result<Date, InvalidDayOfYear>
[src]
self,
day_of_year: u16
) -> Result<Date, InvalidDayOfYear>
Combine the year with a day-of-year to create a Date
.
Day-of-year numbers start a 1 for January 1.
pub const fn first_month(self) -> YearMonth
[src]
Get the first month of the year as YearMonth
.
pub const fn last_month(self) -> YearMonth
[src]
Get the last month of the year as YearMonth
.
pub const fn months(self) -> [YearMonth; 12]
[src]
Get all months of the year as YearMonth
array.
pub const fn first_day(self) -> Date
[src]
Get the first day of the year as Date
.
pub const fn last_day(self) -> Date
[src]
Get the last day of the year as Date
.
Trait Implementations
impl Add<i16> for Year
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: i16) -> Self
[src]
impl AddAssign<i16> for Year
[src]
fn add_assign(&mut self, other: i16)
[src]
impl Clone for Year
[src]
impl Copy for Year
[src]
impl Debug for Year
[src]
impl Display for Year
[src]
impl Eq for Year
[src]
impl From<Year> for i16
[src]
impl From<i16> for Year
[src]
impl Hash for Year
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Year
[src]
fn cmp(&self, other: &Year) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Year> for Year
[src]
impl PartialEq<i16> for Year
[src]
impl PartialOrd<Year> for Year
[src]
fn partial_cmp(&self, other: &Year) -> Option<Ordering>
[src]
fn lt(&self, other: &Year) -> bool
[src]
fn le(&self, other: &Year) -> bool
[src]
fn gt(&self, other: &Year) -> bool
[src]
fn ge(&self, other: &Year) -> bool
[src]
impl PartialOrd<i16> for Year
[src]
fn partial_cmp(&self, other: &i16) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for Year
[src]
impl StructuralPartialEq for Year
[src]
impl Sub<i16> for Year
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: i16) -> Self
[src]
impl SubAssign<i16> for Year
[src]
fn sub_assign(&mut self, other: i16)
[src]
Auto Trait Implementations
impl RefUnwindSafe for Year
impl Send for Year
impl Sync for Year
impl Unpin for Year
impl UnwindSafe for Year
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,