Trait TimeRange

Source
pub trait TimeRange<T> {
    // Required methods
    fn hours(&self) -> impl Iterator<Item = T>;
    fn minutes(&self) -> impl Iterator<Item = T>;
    fn seconds(&self) -> impl Iterator<Item = T>;
    fn hours_with_iter(&self, end: &Self) -> impl Iterator<Item = T>;
    fn minutes_with_iter(&self, end: &Self) -> impl Iterator<Item = T>;
    fn seconds_with_iter(&self, end: &Self) -> impl Iterator<Item = T>;
}

Required Methods§

Source

fn hours(&self) -> impl Iterator<Item = T>

返回一个迭代器,用于遍历该对象表示的小时数。

迭代器中的每个元素类型为T,表示该对象中的一个小时。

§参数:
  • self:当前对象的引用。
§返回值:
  • 一个实现了Iterator特质的迭代器,用于遍历小时数,元素类型为T
Source

fn minutes(&self) -> impl Iterator<Item = T>

返回一个迭代器,用于遍历该对象表示的分钟数。

迭代器中的每个元素类型为 T,表示该对象中的一个分钟。

§参数:
  • self:当前对象的引用。
§返回值:
  • 实现了 Iterator 特质的迭代器,用于遍历分钟数,元素类型为 T
Source

fn seconds(&self) -> impl Iterator<Item = T>

返回一个迭代器,用于遍历该对象表示的秒数。

迭代器中的每个元素类型为 T,表示该对象中的一个秒。

§参数:
  • self:当前对象的引用。
§返回值:
  • 实现了 Iterator 特质的迭代器,用于遍历秒数,元素类型为 T
Source

fn hours_with_iter(&self, end: &Self) -> impl Iterator<Item = T>

返回一个迭代器,用于遍历该对象表示的小时数。

§参数:
  • self:当前对象的引用。
§返回值:
  • 实现了 Iterator 特质的迭代器,用于遍历小时数,元素类型为 T
Source

fn minutes_with_iter(&self, end: &Self) -> impl Iterator<Item = T>

返回一个迭代器,用于遍历该对象表示的分钟数。

§参数:
  • self:当前对象的引用。
§返回值:
  • 实现了 Iterator 特质的迭代器,用于遍历分钟数,元素类型为 T
Source

fn seconds_with_iter(&self, end: &Self) -> impl Iterator<Item = T>

返回一个迭代器,用于遍历该对象表示的秒数。

§参数:
  • self:当前对象的引用。
§返回值:
  • 实现了 Iterator 特质的迭代器,用于遍历秒数,元素类型为 T

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 TimeRange<NaiveDateTime> for NaiveDateTime

Source§

fn hours(&self) -> impl Iterator<Item = NaiveDateTime>

Source§

fn minutes(&self) -> impl Iterator<Item = NaiveDateTime>

Source§

fn seconds(&self) -> impl Iterator<Item = NaiveDateTime>

Source§

fn hours_with_iter(&self, end: &Self) -> impl Iterator<Item = NaiveDateTime>

Source§

fn minutes_with_iter(&self, end: &Self) -> impl Iterator<Item = NaiveDateTime>

Source§

fn seconds_with_iter(&self, end: &Self) -> impl Iterator<Item = NaiveDateTime>

Implementors§