Struct sqldatetime::IntervalDT[][src]

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

Day-Time Interval represents the duration of a period of time, has an interval precision that includes DAY, HOUR, MINUTE, SECOND, MICROSECOND.

Implementations

impl IntervalDT[src]

pub const MIN: Self[src]

The smallest interval that can be represented by IntervalDT, i.e. -100000000 00:00:00.000000.

pub const MAX: Self[src]

The largest interval that can be represented by IntervalDT, i.e. 100000000 00:00:00.000000.

pub const ZERO: Self[src]

The zero value of interval, i.e. 0 00:00:00.000000.

pub const unsafe fn from_dhms_unchecked(
    day: u32,
    hour: u32,
    minute: u32,
    sec: u32,
    usec: u32
) -> Self
[src]

Creates a IntervalDT from the given day, hour, minute, second and microsecond.

Safety

This function is unsafe because the values are not checked for validity! Before using it, check that the values are all correct.

pub const fn try_from_dhms(
    day: u32,
    hour: u32,
    minute: u32,
    sec: u32,
    usec: u32
) -> Result<Self, Error>
[src]

Creates a IntervalDT from the given day, hour, minute, second and microsecond.

pub const fn is_valid(
    day: u32,
    hour: u32,
    minute: u32,
    sec: u32,
    usec: u32
) -> bool
[src]

Checks if the given day, hour, minute, second and microsecond fields are valid.

pub const fn extract(self) -> (Sign, u32, u32, u32, u32, u32)[src]

Extracts (day, hour, minute, second, microsecond) from the interval.

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

Formats IntervalDT by given format string.

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

Parses IntervalDT from given string and format.

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

IntervalDT adds IntervalDT

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

IntervalDT subtracts IntervalDT

pub fn mul_f64(self, number: f64) -> Result<IntervalDT, Error>[src]

IntervalDT multiplies f64

pub fn div_f64(self, number: f64) -> Result<IntervalDT, Error>[src]

IntervalDT divides f64

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

IntervalDT subtracts Time

Trait Implementations

impl Clone for IntervalDT[src]

fn clone(&self) -> IntervalDT[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 IntervalDT[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 IntervalDT[src]

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

Formats the value using the given formatter. Read more

impl From<Time> for IntervalDT[src]

fn from(time: Time) -> Self[src]

Performs the conversion.

impl Hash for IntervalDT[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 Neg for IntervalDT[src]

type Output = IntervalDT

The resulting type after applying the - operator.

fn neg(self) -> Self::Output[src]

Performs the unary - operation. Read more

impl Ord for IntervalDT[src]

fn cmp(&self, other: &IntervalDT) -> 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<IntervalDT> for IntervalDT[src]

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

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

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

This method tests for !=.

impl PartialEq<IntervalDT> for Time[src]

fn eq(&self, other: &IntervalDT) -> 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<Time> for IntervalDT[src]

fn eq(&self, other: &Time) -> 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<IntervalDT> for IntervalDT[src]

fn partial_cmp(&self, other: &IntervalDT) -> 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<IntervalDT> for Time[src]

fn partial_cmp(&self, other: &IntervalDT) -> 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<Time> for IntervalDT[src]

fn partial_cmp(&self, other: &Time) -> 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 Copy for IntervalDT[src]

impl Eq for IntervalDT[src]

impl StructuralEq for IntervalDT[src]

impl StructuralPartialEq for IntervalDT[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.