Trait QuarterHelper

Source
pub trait QuarterHelper {
    // Required methods
    fn begin_of_quarter(&self) -> Self;
    fn end_of_quarter(&self) -> Self;
    fn is_same_quarter(&self, other: &Self) -> bool;
    fn quarter(&self) -> Quarter;
    fn add_quarters(&self, quarters: i32) -> Self;
    fn add_quarters_opt(&self, quarters: i32) -> Option<Self>
       where Self: Sized;
    fn sub_quarters(&self, quarters: i32) -> Self;
    fn sub_quarters_opt(&self, quarters: i32) -> Option<Self>
       where Self: Sized;
    fn diff_calendar_quarters(&self, other: &Self) -> i64;
    fn diff_quarters(&self, other: &Self) -> i64;
}

Required Methods§

Source

fn begin_of_quarter(&self) -> Self

English: Get the first day of the quarter

中文: 获取季度的第一天

Source

fn end_of_quarter(&self) -> Self

English: Get the last day of the quarter

中文: 获取季度的最后一天

Source

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

English: Whether the two dates are in the same quarter

中文: 两个日期是否在同一个季度

Source

fn quarter(&self) -> Quarter

English: Get the quarter of the year

中文: 获取年份的季度

Source

fn add_quarters(&self, quarters: i32) -> Self

English: Add the specified number of year quarters to the given date.

中文: 给定日期增加指定的年份季度数。

Source

fn add_quarters_opt(&self, quarters: i32) -> Option<Self>
where Self: Sized,

English: Add the specified number of year quarters to the given date.

中文: 给定日期增加指定的年份季度数。

Source

fn sub_quarters(&self, quarters: i32) -> Self

English: Subtract the specified number of year quarters from the given date.

中文: 给定日期减去指定的年份季度数。

Source

fn sub_quarters_opt(&self, quarters: i32) -> Option<Self>
where Self: Sized,

English: Subtract the specified number of year quarters from the given date.

中文: 给定日期减去指定的年份季度数。

Source

fn diff_calendar_quarters(&self, other: &Self) -> i64

English: Get the number of calendar quarters between the given dates.

中文: 获取两个日期之间的日历季度数。

Source

fn diff_quarters(&self, other: &Self) -> i64

English: Get the number of quarters between the given dates.

中文: 获取两个日期之间的季度数。

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl QuarterHelper for NaiveDate

Source§

fn begin_of_quarter(&self) -> Self

Source§

fn end_of_quarter(&self) -> Self

Source§

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

Source§

fn quarter(&self) -> Quarter

Source§

fn add_quarters(&self, quarters: i32) -> Self

Source§

fn add_quarters_opt(&self, quarters: i32) -> Option<Self>
where Self: Sized,

Source§

fn sub_quarters(&self, quarters: i32) -> Self

Source§

fn sub_quarters_opt(&self, quarters: i32) -> Option<Self>
where Self: Sized,

Source§

fn diff_calendar_quarters(&self, other: &Self) -> i64

Source§

fn diff_quarters(&self, other: &Self) -> i64

Implementors§