[−][src]Struct pgdatetime::Interval
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]
years: i32,
months: i32,
weeks: i32,
days: i32,
hours: i32,
minutes: i32,
seconds: f64
) -> Result<Interval, DateTimeError>
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]
s: &str,
type_mod: i32,
format_type: IntervalStyle
) -> Result<Self, DateTimeError>
Parses Internal
from string.
pub fn format(
self,
interval_format: IntervalStyle
) -> Result<String, DateTimeError>
[src]
self,
interval_format: IntervalStyle
) -> Result<String, DateTimeError>
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.
fn add(self, rhs: Interval) -> Self::Output
[src]
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]
&self,
ty: FieldType,
unit: DateUnit
) -> Result<Option<f64>, DateTimeError>
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.
fn is_infinite(&self) -> bool
[src]
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Interval
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Interval> for Interval
[src]
impl PartialOrd<Interval> for Interval
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for Interval
[src]
impl StructuralPartialEq for Interval
[src]
Auto Trait Implementations
impl RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl UnwindSafe for Interval
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,