Struct sqldatetime::IntervalYM

source ·
#[repr(transparent)]
pub struct IntervalYM(_);
Expand description

Year-Month Interval represents the duration of a period of time, has an interval precision that includes a YEAR field or a MONTH field, or both.

Implementations§

source§

impl IntervalYM

source

pub const MIN: Self = _

The smallest interval that can be represented by IntervalYM, i.e. -178000000-00.

source

pub const MAX: Self = _

The largest interval that can be represented by IntervalYM, i.e. 178000000-00.

source

pub const ZERO: Self = _

The zero value of interval, i.e. 00-00.

source

pub const unsafe fn from_ym_unchecked(year: u32, month: u32) -> Self

Creates a IntervalYM from the given year and month.

Safety

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

source

pub const unsafe fn from_months_unchecked(months: i32) -> Self

Creates a IntervalYM from the given months without checking validity.

Safety

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

source

pub const fn try_from_ym(year: u32, month: u32) -> Result<Self, Error>

Creates a IntervalYM from the given year and month.

source

pub const fn try_from_months(months: i32) -> Result<Self, Error>

Creates a IntervalYM from the given months.

source

pub const fn is_valid_ym(year: u32, month: u32) -> bool

Checks if the given year and month are valid.

source

pub const fn months(self) -> i32

Gets the months of IntervalYM.

source

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

Extracts (sign, year, month) from the interval.

source

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

Formats IntervalYM by given format string.

source

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

Parses IntervalYM from given string and format.

source

pub const fn add_interval_ym( self, interval: IntervalYM ) -> Result<IntervalYM, Error>

IntervalYM adds IntervalYM

source

pub const fn sub_interval_ym( self, interval: IntervalYM ) -> Result<IntervalYM, Error>

IntervalYM subtracts IntervalYM

source

pub fn mul_f64(self, number: f64) -> Result<IntervalYM, Error>

IntervalYM multiplies f64

source

pub fn div_f64(self, number: f64) -> Result<IntervalYM, Error>

IntervalYM divides f64

Trait Implementations§

source§

impl Clone for IntervalYM

source§

fn clone(&self) -> IntervalYM

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl DateTime for IntervalYM

source§

fn year(&self) -> Option<i32>

Extracts year from date time.
source§

fn month(&self) -> Option<i32>

Extracts month from date time.
source§

fn day(&self) -> Option<i32>

Extracts day from date time.
source§

fn hour(&self) -> Option<i32>

Extracts hour from date time.
source§

fn minute(&self) -> Option<i32>

Extracts minute from date time.
source§

fn second(&self) -> Option<f64>

Extracts second from date time.
source§

fn date(&self) -> Option<Date>

Extracts second from date time.
source§

impl Debug for IntervalYM

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for IntervalYM

Available on crate feature serde only.
source§

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

Deserialize this value from the given Serde deserializer. Read more
source§

impl Hash for IntervalYM

source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · source§

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

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

impl Neg for IntervalYM

§

type Output = IntervalYM

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl Ord for IntervalYM

source§

fn cmp(&self, other: &IntervalYM) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<IntervalYM> for IntervalYM

source§

fn eq(&self, other: &IntervalYM) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<IntervalYM> for IntervalYM

source§

fn partial_cmp(&self, other: &IntervalYM) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl Serialize for IntervalYM

Available on crate feature serde only.
source§

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

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for IntervalYM

source§

impl Eq for IntervalYM

source§

impl StructuralEq for IntervalYM

source§

impl StructuralPartialEq for IntervalYM

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,