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
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§
source§impl Clone for IntervalYM
impl Clone for IntervalYM
source§fn clone(&self) -> IntervalYM
fn clone(&self) -> IntervalYM
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl DateTime for IntervalYM
impl DateTime for IntervalYM
source§impl Debug for IntervalYM
impl Debug for IntervalYM
source§impl<'de> Deserialize<'de> for IntervalYM
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for IntervalYM
serde
only.source§fn 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>,
source§impl Hash for IntervalYM
impl Hash for IntervalYM
source§impl Neg for IntervalYM
impl Neg for IntervalYM
source§impl Ord for IntervalYM
impl Ord for IntervalYM
source§fn cmp(&self, other: &IntervalYM) -> Ordering
fn cmp(&self, other: &IntervalYM) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<IntervalYM> for IntervalYM
impl PartialEq<IntervalYM> for IntervalYM
source§fn eq(&self, other: &IntervalYM) -> bool
fn eq(&self, other: &IntervalYM) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<IntervalYM> for IntervalYM
impl PartialOrd<IntervalYM> for IntervalYM
source§fn partial_cmp(&self, other: &IntervalYM) -> Option<Ordering>
fn partial_cmp(&self, other: &IntervalYM) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for IntervalYM
Available on crate feature serde
only.
impl Serialize for IntervalYM
serde
only.