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
sourceimpl IntervalYM
impl IntervalYM
sourcepub const MIN: Self = _
pub const MIN: Self = _
The smallest interval that can be represented by IntervalYM, i.e. -178000000-00.
sourcepub const MAX: Self = _
pub const MAX: Self = _
The largest interval that can be represented by IntervalYM, i.e. 178000000-00.
sourcepub const unsafe fn from_ym_unchecked(year: u32, month: u32) -> Self
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.
sourcepub const unsafe fn from_months_unchecked(months: i32) -> Self
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.
sourcepub const fn try_from_ym(year: u32, month: u32) -> Result<Self, Error>
pub const fn try_from_ym(year: u32, month: u32) -> Result<Self, Error>
Creates a IntervalYM from the given year and month.
sourcepub const fn try_from_months(months: i32) -> Result<Self, Error>
pub const fn try_from_months(months: i32) -> Result<Self, Error>
Creates a IntervalYM from the given months.
sourcepub const fn is_valid_ym(year: u32, month: u32) -> bool
pub const fn is_valid_ym(year: u32, month: u32) -> bool
Checks if the given year and month are valid.
sourcepub fn format<S: AsRef<str>>(self, fmt: S) -> Result<impl Display, Error>
pub fn format<S: AsRef<str>>(self, fmt: S) -> Result<impl Display, Error>
Formats IntervalYM by given format string.
sourcepub fn parse<S1: AsRef<str>, S2: AsRef<str>>(
input: S1,
fmt: S2
) -> Result<Self, Error>
pub fn parse<S1: AsRef<str>, S2: AsRef<str>>(
input: S1,
fmt: S2
) -> Result<Self, Error>
Parses IntervalYM from given string and format.
sourcepub const fn add_interval_ym(
self,
interval: IntervalYM
) -> Result<IntervalYM, Error>
pub const fn add_interval_ym(
self,
interval: IntervalYM
) -> Result<IntervalYM, Error>
IntervalYM adds IntervalYM
sourcepub const fn sub_interval_ym(
self,
interval: IntervalYM
) -> Result<IntervalYM, Error>
pub const fn sub_interval_ym(
self,
interval: IntervalYM
) -> Result<IntervalYM, Error>
IntervalYM subtracts IntervalYM
Trait Implementations
sourceimpl Clone for IntervalYM
impl Clone for IntervalYM
sourcefn clone(&self) -> IntervalYM
fn clone(&self) -> IntervalYM
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read moresourceimpl DateTime for IntervalYM
impl DateTime for IntervalYM
sourceimpl Debug for IntervalYM
impl Debug for IntervalYM
sourceimpl<'de> Deserialize<'de> for IntervalYM
Available on crate feature serde only.
impl<'de> Deserialize<'de> for IntervalYM
serde only.sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
sourceimpl Hash for IntervalYM
impl Hash for IntervalYM
sourceimpl Neg for IntervalYM
impl Neg for IntervalYM
sourceimpl Ord for IntervalYM
impl Ord for IntervalYM
sourcefn cmp(&self, other: &IntervalYM) -> Ordering
fn cmp(&self, other: &IntervalYM) -> Ordering
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialEq<IntervalYM> for IntervalYM
impl PartialEq<IntervalYM> for IntervalYM
sourcefn eq(&self, other: &IntervalYM) -> bool
fn eq(&self, other: &IntervalYM) -> bool
sourceimpl PartialOrd<IntervalYM> for IntervalYM
impl PartialOrd<IntervalYM> for IntervalYM
sourcefn partial_cmp(&self, other: &IntervalYM) -> Option<Ordering>
fn partial_cmp(&self, other: &IntervalYM) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresourceimpl Serialize for IntervalYM
Available on crate feature serde only.
impl Serialize for IntervalYM
serde only.