Struct sqldatetime::Timestamp[][src]

#[repr(transparent)]
pub struct Timestamp(_);
Expand description

Timestamp represents a valid time at a valid Gregorian date.

This is an SQL TIMESTAMP value, with the specification of fractional seconds to a precision of microseconds.

Implementations

impl Timestamp[src]

pub const MIN: Self[src]

The smallest timestamp that can be represented by Date, i.e. 0001-01-01 00:00:00.000000.

pub const MAX: Self[src]

The largest timestamp that can be represented by Date, i.e. 9999-12-31 23:59:59.999999.

pub const fn new(date: Date, time: Time) -> Self[src]

Creates a new Timestamp from a date and a time.

pub const fn extract(self) -> (Date, Time)[src]

Extracts (Date, Time) from the timestamp.

pub const fn usecs(self) -> i64[src]

Gets the microseconds from Unix Epoch of Timestamp.

pub const unsafe fn from_usecs_unchecked(usecs: i64) -> Self[src]

Creates a Timestamp from the given microseconds from Unix Epoch without checking validity.

Safety

This function is unsafe because the microsecond value is not checked for validity! Before using it, check that the value is correct.

pub fn format<S: AsRef<str>>(self, fmt: S) -> Result<impl Display, Error>[src]

Formats Timestamp by given format string.

pub fn parse<S1: AsRef<str>, S2: AsRef<str>>(
    input: S1,
    fmt: S2
) -> Result<Self, Error>
[src]

Parses Timestamp from given string and format.

pub const fn try_from_usecs(usecs: i64) -> Result<Self, Error>[src]

Creates a Timestamp from the given microseconds from Unix Epoch

pub const fn add_interval_dt(
    self,
    interval: IntervalDT
) -> Result<Timestamp, Error>
[src]

Timestamp adds IntervalDT

pub fn add_interval_ym(self, interval: IntervalYM) -> Result<Timestamp, Error>[src]

Timestamp adds IntervalYM

pub const fn add_time(self, time: Time) -> Result<Timestamp, Error>[src]

Timestamp add Time

pub fn add_days(self, days: f64) -> Result<Timestamp, Error>[src]

Timestamp add days

pub const fn sub_date(self, date: Date) -> IntervalDT[src]

Timestamp subtracts Date

pub const fn sub_time(self, time: Time) -> Result<Timestamp, Error>[src]

Timestamp subtracts Time

pub const fn sub_timestamp(self, timestamp: Timestamp) -> IntervalDT[src]

Timestamp subtracts Timestamp

pub const fn sub_interval_dt(
    self,
    interval: IntervalDT
) -> Result<Timestamp, Error>
[src]

Timestamp subtracts IntervalDT

pub fn sub_interval_ym(self, interval: IntervalYM) -> Result<Timestamp, Error>[src]

Timestamp subtracts IntervalYM

pub fn sub_days(self, days: f64) -> Result<Timestamp, Error>[src]

Timestamp subtracts days

impl Timestamp[src]

pub const fn oracle_sub_date(self, date: Date) -> IntervalDT[src]

Timestamp subtracts Date

pub fn oracle_add_days(self, days: f64) -> Result<Date, Error>[src]

Timestamp add days

pub fn oracle_sub_days(self, days: f64) -> Result<Date, Error>[src]

Timestamp subtracts days

Trait Implementations

impl Clone for Timestamp[src]

fn clone(&self) -> Timestamp[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl DateTime for Timestamp[src]

fn year(&self) -> Option<i32>[src]

Extracts year from date time.

fn month(&self) -> Option<i32>[src]

Extracts month from date time.

fn day(&self) -> Option<i32>[src]

Extracts day from date time.

fn hour(&self) -> Option<i32>[src]

Extracts hour from date time.

fn minute(&self) -> Option<i32>[src]

Extracts minute from date time.

fn second(&self) -> Option<f64>[src]

Extracts second from date time.

impl Debug for Timestamp[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'de> Deserialize<'de> for Timestamp[src]

This is supported on crate feature serde only.

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
    D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl From<Date> for Timestamp[src]

fn from(date: Date) -> Self[src]

Performs the conversion.

impl From<Date> for Timestamp[src]

fn from(input: Date) -> Self[src]

Performs the conversion.

impl From<Timestamp> for Date[src]

fn from(timestamp: Timestamp) -> Self[src]

Performs the conversion.

impl Hash for Timestamp[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl Ord for Timestamp[src]

fn cmp(&self, other: &Timestamp) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<Date> for Timestamp[src]

fn eq(&self, other: &Date) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialEq<Date> for Timestamp[src]

fn eq(&self, other: &Date) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialEq<Timestamp> for Date[src]

fn eq(&self, other: &Timestamp) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialEq<Timestamp> for Timestamp[src]

fn eq(&self, other: &Timestamp) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Timestamp) -> bool[src]

This method tests for !=.

impl PartialEq<Timestamp> for Date[src]

fn eq(&self, other: &Timestamp) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialOrd<Date> for Timestamp[src]

fn partial_cmp(&self, other: &Date) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialOrd<Date> for Timestamp[src]

fn partial_cmp(&self, other: &Date) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialOrd<Timestamp> for Date[src]

fn partial_cmp(&self, other: &Timestamp) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialOrd<Timestamp> for Timestamp[src]

fn partial_cmp(&self, other: &Timestamp) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialOrd<Timestamp> for Date[src]

fn partial_cmp(&self, other: &Timestamp) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Serialize for Timestamp[src]

This is supported on crate feature serde only.

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
    S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl Copy for Timestamp[src]

impl Eq for Timestamp[src]

impl StructuralEq for Timestamp[src]

impl StructuralPartialEq for Timestamp[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]