Struct tantivy_columnar::DateTime
source · pub struct DateTime { /* private fields */ }
Expand description
A date/time value with nanoseconds precision.
This timestamp does not carry any explicit time zone information. Users are responsible for applying the provided conversion functions consistently. Internally the time zone is assumed to be UTC, which is also used implicitly for JSON serialization.
All constructors and conversions are provided as explicit
functions and not by implementing any From
/Into
traits
to prevent unintended usage.
Implementations§
source§impl DateTime
impl DateTime
sourcepub const fn from_timestamp_secs(seconds: i64) -> DateTime
pub const fn from_timestamp_secs(seconds: i64) -> DateTime
Create new from UNIX timestamp in seconds
sourcepub const fn from_timestamp_millis(milliseconds: i64) -> DateTime
pub const fn from_timestamp_millis(milliseconds: i64) -> DateTime
Create new from UNIX timestamp in milliseconds
sourcepub const fn from_timestamp_micros(microseconds: i64) -> DateTime
pub const fn from_timestamp_micros(microseconds: i64) -> DateTime
Create new from UNIX timestamp in microseconds.
sourcepub const fn from_timestamp_nanos(nanoseconds: i64) -> DateTime
pub const fn from_timestamp_nanos(nanoseconds: i64) -> DateTime
Create new from UNIX timestamp in nanoseconds.
sourcepub fn from_utc(dt: OffsetDateTime) -> DateTime
pub fn from_utc(dt: OffsetDateTime) -> DateTime
Create new from OffsetDateTime
The given date/time is converted to UTC and the actual time zone is discarded.
sourcepub fn from_primitive(dt: PrimitiveDateTime) -> DateTime
pub fn from_primitive(dt: PrimitiveDateTime) -> DateTime
Create new from PrimitiveDateTime
Implicitly assumes that the given date/time is in UTC!
Otherwise the original value must only be reobtained with
Self::into_primitive()
.
sourcepub const fn into_timestamp_secs(self) -> i64
pub const fn into_timestamp_secs(self) -> i64
Convert to UNIX timestamp in seconds.
sourcepub const fn into_timestamp_millis(self) -> i64
pub const fn into_timestamp_millis(self) -> i64
Convert to UNIX timestamp in milliseconds.
sourcepub const fn into_timestamp_micros(self) -> i64
pub const fn into_timestamp_micros(self) -> i64
Convert to UNIX timestamp in microseconds.
sourcepub const fn into_timestamp_nanos(self) -> i64
pub const fn into_timestamp_nanos(self) -> i64
Convert to UNIX timestamp in nanoseconds.
sourcepub fn into_utc(self) -> OffsetDateTime
pub fn into_utc(self) -> OffsetDateTime
Convert to UTC OffsetDateTime
sourcepub fn into_offset(self, offset: UtcOffset) -> OffsetDateTime
pub fn into_offset(self, offset: UtcOffset) -> OffsetDateTime
Convert to OffsetDateTime
with the given time zone
sourcepub fn into_primitive(self) -> PrimitiveDateTime
pub fn into_primitive(self) -> PrimitiveDateTime
Convert to PrimitiveDateTime
without any time zone
The value should have been constructed with Self::from_primitive()
.
Otherwise the time zone is implicitly assumed to be UTC.
sourcepub fn truncate(self, precision: DateTimePrecision) -> DateTime
pub fn truncate(self, precision: DateTimePrecision) -> DateTime
Truncates the microseconds value to the corresponding precision.
Trait Implementations§
source§impl BinarySerializable for DateTime
impl BinarySerializable for DateTime
source§impl<'de> Deserialize<'de> for DateTime
impl<'de> Deserialize<'de> for DateTime
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<DateTime, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<DateTime, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl HasAssociatedColumnType for DateTime
impl HasAssociatedColumnType for DateTime
fn column_type() -> ColumnType
fn default_value() -> Self
source§impl Ord for DateTime
impl Ord for DateTime
source§impl PartialEq for DateTime
impl PartialEq for DateTime
source§impl PartialOrd for DateTime
impl PartialOrd for DateTime
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for DateTime
impl Serialize for DateTime
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for DateTime
impl Eq for DateTime
impl StructuralPartialEq for DateTime
Auto Trait Implementations§
impl Freeze for DateTime
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.