[][src]Struct pgdatetime::Interval

#[repr(C)]pub struct Interval { /* fields omitted */ }

Interval represents delta time.

Implementations

impl Interval[src]

pub const fn new() -> Self[src]

Construct a Interval value.

pub fn try_from_ymwd_hms(
    years: i32,
    months: i32,
    weeks: i32,
    days: i32,
    hours: i32,
    minutes: i32,
    seconds: f64
) -> Result<Interval, DateTimeError>
[src]

Constructs Interval from year, month, weak, day, hour, minute and second. second can indicate millisecond and microsecond.

pub fn add_interval(self, span: Self) -> Result<Self, DateTimeError>[src]

Interval subtracts Interval.

pub fn negate(self) -> Result<Self, DateTimeError>[src]

Negate of Interval.

pub fn sub_interval(self, span: Self) -> Result<Self, DateTimeError>[src]

Interval subtracts Interval.

pub fn justify_hours(self) -> Self[src]

Adjusts Interval. so time of Interval contains less than a whole day, adding the excess to day of Interval. This is useful for situations (such as non-TZ) where '1 day' = '24 hours' is valid, e.g. interval subtraction and division.

pub fn justify_days(self) -> Self[src]

Adjust Interval so day of Interval contains less than 30 days, adding the excess to 'month'.

pub fn justify_interval(self) -> Self[src]

Adjusts Interval. so month, day, and time portions are within customary bounds. Specifically: 0 <= abs(time) < 24 hours 0 <= abs(day) < 30 days Also, the sign bit on all three fields is made equal, so either all three fields are negative or all are positive.

pub fn mul_f64(self, factor: f64) -> Result<Self, DateTimeError>[src]

Interval multiply float64.

pub fn div_f64(self, factor: f64) -> Result<Self, DateTimeError>[src]

Interval divides float64.

pub fn try_from_str(
    s: &str,
    type_mod: i32,
    format_type: IntervalStyle
) -> Result<Self, DateTimeError>
[src]

Parses Internal from string.

pub fn format(
    self,
    interval_format: IntervalStyle
) -> Result<String, DateTimeError>
[src]

Converts Interval to string.

Trait Implementations

impl Add<Interval> for Interval[src]

Used for no overflow checked.

type Output = Interval

The resulting type after applying the + operator.

impl Clone for Interval[src]

impl Copy for Interval[src]

impl DateTime for Interval[src]

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

Extracts specified field from Interval.

fn is_finite(&self) -> bool[src]

Checks whether Interval is finite.

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

Truncates Interval to specified units.

impl Debug for Interval[src]

impl Eq for Interval[src]

impl From<Interval> for i128[src]

impl From<Interval> for Time[src]

Converts Interval to Time. This is defined as producing the fractional-day portion of the interval. Therefore, we can just ignore the months field. It is not real clear what to do with negative intervals, but we choose to subtract the floor, so that, say, '-2 hours' becomes '22:00:00'.

impl From<Time> for Interval[src]

Converts Time to Interval.

impl Hash for Interval[src]

impl Ord for Interval[src]

impl PartialEq<Interval> for Interval[src]

impl PartialOrd<Interval> for Interval[src]

impl StructuralEq for Interval[src]

impl StructuralPartialEq for Interval[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.