Skip to main content

ArrowTimestampType

Trait ArrowTimestampType 

Source
pub trait ArrowTimestampType: ArrowTemporalType<Native = i64> {
    const UNIT: TimeUnit;

    // Required methods
    fn make_value(naive: NaiveDateTime) -> Option<i64>;
    fn from_datetime<Tz: TimeZone>(datetime: DateTime<Tz>) -> Option<i64>;

    // Provided method
    fn from_naive_datetime(naive: NaiveDateTime, tz: Option<&Tz>) -> Option<i64> { ... }
}
Expand description

A timestamp type allows us to create array builders that take a timestamp.

Required Associated Constants§

Source

const UNIT: TimeUnit

The TimeUnit of this timestamp.

Required Methods§

Source

fn make_value(naive: NaiveDateTime) -> Option<i64>

Creates a ArrowTimestampType::Native from the provided NaiveDateTime

See DataType::Timestamp for more information on timezone handling

Source

fn from_datetime<Tz: TimeZone>(datetime: DateTime<Tz>) -> Option<i64>

Creates a timestamp value from a DateTime in any timezone.

Returns None if the timestamp value would overflow the i64 range (e.g., for nanosecond precision with extreme datetime values).

§Arguments
  • datetime - The datetime to convert

Provided Methods§

Source

fn from_naive_datetime(naive: NaiveDateTime, tz: Option<&Tz>) -> Option<i64>

Creates a timestamp value from a NaiveDateTime interpreted in the given timezone.

§Arguments
  • naive - The local datetime to convert
  • tz - Optional timezone. If None, interprets as UTC (equivalent to calling Self::make_value).

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§