DateTime

Trait DateTime 

Source
pub trait DateTime: Sized {
    // Required methods
    fn date_part(
        &self,
        ty: FieldType,
        unit: DateUnit,
    ) -> Result<Option<f64>, DateTimeError>;
    fn is_finite(&self) -> bool;
    fn truncate(
        &self,
        ty: FieldType,
        unit: DateUnit,
    ) -> Result<Self, DateTimeError>;

    // Provided method
    fn is_infinite(&self) -> bool { ... }
}
Expand description

General trait for all date time types.

Required Methods§

Source

fn date_part( &self, ty: FieldType, unit: DateUnit, ) -> Result<Option<f64>, DateTimeError>

Extracts specified field from date time.

Source

fn is_finite(&self) -> bool

Checks whether date time is finite.

Source

fn truncate(&self, ty: FieldType, unit: DateUnit) -> Result<Self, DateTimeError>

Truncates date type to specified units.

Provided Methods§

Source

fn is_infinite(&self) -> bool

Checks whether date time is infinite.

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.

Implementors§