Skip to main content

jiff/util/
b.rs

1/*!
2A module for constants and various base utilities.
3
4This module is a work-in-progress that may lead to helping us move off of
5ranged integers. I'm not quite sure where this will go.
6*/
7
8use jcore::{
9    bounds::{self, Bounds, RawBoundsError, const_check},
10    constants as c,
11};
12
13use crate::Error;
14
15/// Writes the definition of a single boundary type.
16///
17/// When only the name and type are given, then this copies the `WHAT`,
18/// `MIN` and `MAX` definitions from `jcore`. This avoids copying the specific
19/// range values and maintains a single point of truth.
20macro_rules! define_one_boundary_type {
21    (
22        // The name of the boundary type.
23        $name:ident,
24        // The underlying primitive type. This is usually, but not always,
25        // the smallest signed primitive integer type that can represent both
26        // the minimum and maximum boundary values.
27        $ty:ident,
28        // A short human readable description that appears in error messages
29        // when the boundaries of this type are violated.
30        $what:expr,
31        // The minimum value.
32        $min:expr,
33        // The maximum value.
34        $max:expr $(,)?
35    ) => {
36        pub(crate) struct $name(());
37
38        impl Bounds for $name {
39            const WHAT: &'static str = $what;
40            const MIN: Self::Primitive = $min;
41            const MAX: Self::Primitive = $max;
42            type Primitive = $ty;
43            type Error = BoundsError;
44
45            #[cold]
46            #[inline(never)]
47            fn error() -> BoundsError {
48                Self::error()
49            }
50        }
51
52        #[allow(dead_code)]
53        impl $name {
54            pub(crate) const MIN: $ty = <$name as Bounds>::MIN;
55            pub(crate) const MAX: $ty = <$name as Bounds>::MAX;
56            const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
57
58            #[cold]
59            pub(crate) const fn error() -> BoundsError {
60                BoundsError::$name(RawBoundsError::new())
61            }
62
63            #[cfg_attr(feature = "perf-inline", inline(always))]
64            pub(crate) fn check(
65                n: impl Into<i64>,
66            ) -> Result<$ty, BoundsError> {
67                <$name as Bounds>::check(n)
68            }
69
70            #[cfg_attr(feature = "perf-inline", inline(always))]
71            pub(crate) const fn checkc(n: i64) -> Result<$ty, BoundsError> {
72                match const_check::$ty(n) {
73                    Ok(n) => Ok(n),
74                    Err(err) => Err(BoundsError::$name(err)),
75                }
76            }
77
78            #[cfg_attr(feature = "perf-inline", inline(always))]
79            pub(crate) fn checked_add(
80                n1: $ty,
81                n2: $ty,
82            ) -> Result<$ty, BoundsError> {
83                <$name as Bounds>::checked_add(n1, n2)
84            }
85
86            #[cfg_attr(feature = "perf-inline", inline(always))]
87            pub(crate) fn checked_mul(
88                n1: $ty,
89                n2: $ty,
90            ) -> Result<$ty, BoundsError> {
91                <$name as Bounds>::checked_mul(n1, n2)
92            }
93
94            #[cfg(test)]
95            pub(crate) fn arbitrary(g: &mut quickcheck::Gen) -> $ty {
96                use quickcheck::Arbitrary;
97
98                let mut n: $ty = <$ty>::arbitrary(g);
99                n = n.wrapping_rem_euclid(Self::LEN as $ty);
100                n += Self::MIN;
101                n
102            }
103        }
104    };
105    // A shortcut for defining a boundary type in `jiff` that is just a mirror
106    // of a boundary type defined in `jiff-core`. We do this instead of using
107    // the boundary type from `jiff-core` directly because we can't have a
108    // `From` impl on a `jiff-core` error type for `jiff::Error`. (Because
109    // that would make `jiff-core` a public dependency of `jiff`. Which means
110    // any semver incompatible release of `jiff-core` would require a semver
111    // incompatible release of `jiff`. Since `jiff-core` evolves more quickly
112    // than `jiff`, this would be bad juju.)
113    ($name:ident, $ty:ident $(,)?) => {
114        define_one_boundary_type!(
115            $name,
116            $ty,
117            jcore::bounds::$name::WHAT,
118            jcore::bounds::$name::MIN,
119            jcore::bounds::$name::MAX,
120        );
121    };
122}
123
124/// This macro writes out the boiler plate to define a boundary type.
125///
126/// Specifically, it implements the `Bounds` trait and provides a few
127/// concrete methods. The concrete methods are mostly wrappers around
128/// the generic trait methods. They are provided so that callers don't
129/// have to import the `Bounds` trait to use them.
130macro_rules! define_bounds {
131    ($((
132        $name:ident,
133        $ty:ident
134        $($tt:tt)*
135    )),* $(,)?) => {
136        $(
137            define_one_boundary_type!($name, $ty $($tt)*);
138        )*
139
140        /// An error that indicates a value is out of its intended range.
141        #[derive(Clone, Debug)]
142        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
143        pub(crate) enum BoundsError {
144            $($name(RawBoundsError<$name>),)*
145        }
146
147        impl core::fmt::Display for BoundsError {
148            fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
149                match *self {
150                    $(BoundsError::$name(ref err) => err.fmt(f),)*
151                }
152            }
153        }
154    }
155}
156
157// This is where we define all of Jiff's ranges.
158//
159// Well, that's not quite true. Many of them are actually defined in
160// `jiff-core`. For those, we still have an entry here that still produces
161// a boundary type, but it reuses the minimum and maximum values from
162// `jiff-core`. This is so `jiff` completely owns its own boundary types
163// (to avoid a public dep on `jiff-core`) while simultaneously preserving a
164// single point of truth for every range type.
165pub(crate) struct Century(());
impl Bounds for Century {
    const WHAT: &'static str = "century";
    const MIN: Self::Primitive = 0;
    const MAX: Self::Primitive = 99;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Century {
    pub(crate) const MIN: i8 = <Century as Bounds>::MIN;
    pub(crate) const MAX: i8 = <Century as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Century(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <Century as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Century(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Century as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Century as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct CivilDayNanosecond(());
impl Bounds for CivilDayNanosecond {
    const WHAT: &'static str = jcore::bounds::CivilDayNanosecond::WHAT;
    const MIN: Self::Primitive = jcore::bounds::CivilDayNanosecond::MIN;
    const MAX: Self::Primitive = jcore::bounds::CivilDayNanosecond::MAX;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl CivilDayNanosecond {
    pub(crate) const MIN: i64 = <CivilDayNanosecond as Bounds>::MIN;
    pub(crate) const MAX: i64 = <CivilDayNanosecond as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::CivilDayNanosecond(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <CivilDayNanosecond as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::CivilDayNanosecond(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <CivilDayNanosecond as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <CivilDayNanosecond as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct CivilDaySecond(());
impl Bounds for CivilDaySecond {
    const WHAT: &'static str = jcore::bounds::CivilDaySecond::WHAT;
    const MIN: Self::Primitive = jcore::bounds::CivilDaySecond::MIN;
    const MAX: Self::Primitive = jcore::bounds::CivilDaySecond::MAX;
    type Primitive = i32;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl CivilDaySecond {
    pub(crate) const MIN: i32 = <CivilDaySecond as Bounds>::MIN;
    pub(crate) const MAX: i32 = <CivilDaySecond as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::CivilDaySecond(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i32, BoundsError> {
        <CivilDaySecond as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i32, BoundsError> {
        match const_check::i32(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::CivilDaySecond(err)),
        }
    }
    pub(crate) fn checked_add(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <CivilDaySecond as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <CivilDaySecond as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct Day(());
impl Bounds for Day {
    const WHAT: &'static str = jcore::bounds::Day::WHAT;
    const MIN: Self::Primitive = jcore::bounds::Day::MIN;
    const MAX: Self::Primitive = jcore::bounds::Day::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Day {
    pub(crate) const MIN: i8 = <Day as Bounds>::MIN;
    pub(crate) const MAX: i8 = <Day as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Day(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <Day as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Day(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Day as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Day as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct DayOfYear(());
impl Bounds for DayOfYear {
    const WHAT: &'static str = jcore::bounds::DayOfYear::WHAT;
    const MIN: Self::Primitive = jcore::bounds::DayOfYear::MIN;
    const MAX: Self::Primitive = jcore::bounds::DayOfYear::MAX;
    type Primitive = i16;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl DayOfYear {
    pub(crate) const MIN: i16 = <DayOfYear as Bounds>::MIN;
    pub(crate) const MAX: i16 = <DayOfYear as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::DayOfYear(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i16, BoundsError> {
        <DayOfYear as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i16, BoundsError> {
        match const_check::i16(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::DayOfYear(err)),
        }
    }
    pub(crate) fn checked_add(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <DayOfYear as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <DayOfYear as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct Hour(());
impl Bounds for Hour {
    const WHAT: &'static str = jcore::bounds::Hour::WHAT;
    const MIN: Self::Primitive = jcore::bounds::Hour::MIN;
    const MAX: Self::Primitive = jcore::bounds::Hour::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Hour {
    pub(crate) const MIN: i8 = <Hour as Bounds>::MIN;
    pub(crate) const MAX: i8 = <Hour as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Hour(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <Hour as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Hour(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Hour as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Hour as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct Hour12(());
impl Bounds for Hour12 {
    const WHAT: &'static str = "hour (12 hour clock)";
    const MIN: Self::Primitive = 1;
    const MAX: Self::Primitive = 12;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Hour12 {
    pub(crate) const MIN: i8 = <Hour12 as Bounds>::MIN;
    pub(crate) const MAX: i8 = <Hour12 as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Hour12(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <Hour12 as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Hour12(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Hour12 as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Hour12 as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct ISOWeek(());
impl Bounds for ISOWeek {
    const WHAT: &'static str = jcore::bounds::ISOWeek::WHAT;
    const MIN: Self::Primitive = jcore::bounds::ISOWeek::MIN;
    const MAX: Self::Primitive = jcore::bounds::ISOWeek::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl ISOWeek {
    pub(crate) const MIN: i8 = <ISOWeek as Bounds>::MIN;
    pub(crate) const MAX: i8 = <ISOWeek as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::ISOWeek(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <ISOWeek as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::ISOWeek(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <ISOWeek as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <ISOWeek as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct ISOYear(());
impl Bounds for ISOYear {
    const WHAT: &'static str = jcore::bounds::ISOYear::WHAT;
    const MIN: Self::Primitive = jcore::bounds::ISOYear::MIN;
    const MAX: Self::Primitive = jcore::bounds::ISOYear::MAX;
    type Primitive = i16;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl ISOYear {
    pub(crate) const MIN: i16 = <ISOYear as Bounds>::MIN;
    pub(crate) const MAX: i16 = <ISOYear as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::ISOYear(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i16, BoundsError> {
        <ISOYear as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i16, BoundsError> {
        match const_check::i16(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::ISOYear(err)),
        }
    }
    pub(crate) fn checked_add(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <ISOYear as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <ISOYear as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct Increment(());
impl Bounds for Increment {
    const WHAT: &'static str = "rounding increment";
    const MIN: Self::Primitive = 1;
    const MAX: Self::Primitive = 1_000_000_000;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Increment {
    pub(crate) const MIN: i64 = <Increment as Bounds>::MIN;
    pub(crate) const MAX: i64 = <Increment as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Increment(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <Increment as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Increment(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <Increment as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <Increment as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct Increment32(());
impl Bounds for Increment32 {
    const WHAT: &'static str = "rounding increment";
    const MIN: Self::Primitive = 1;
    const MAX: Self::Primitive = 1_000_000_000;
    type Primitive = i32;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Increment32 {
    pub(crate) const MIN: i32 = <Increment32 as Bounds>::MIN;
    pub(crate) const MAX: i32 = <Increment32 as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Increment32(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i32, BoundsError> {
        <Increment32 as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i32, BoundsError> {
        match const_check::i32(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Increment32(err)),
        }
    }
    pub(crate) fn checked_add(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <Increment32 as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <Increment32 as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct LeapSecond(());
impl Bounds for LeapSecond {
    const WHAT: &'static str = "second";
    const MIN: Self::Primitive = 0;
    const MAX: Self::Primitive = 60;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl LeapSecond {
    pub(crate) const MIN: i8 = <LeapSecond as Bounds>::MIN;
    pub(crate) const MAX: i8 = <LeapSecond as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::LeapSecond(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <LeapSecond as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::LeapSecond(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <LeapSecond as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <LeapSecond as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct Microsecond(());
impl Bounds for Microsecond {
    const WHAT: &'static str = jcore::bounds::Microsecond::WHAT;
    const MIN: Self::Primitive = jcore::bounds::Microsecond::MIN;
    const MAX: Self::Primitive = jcore::bounds::Microsecond::MAX;
    type Primitive = i16;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Microsecond {
    pub(crate) const MIN: i16 = <Microsecond as Bounds>::MIN;
    pub(crate) const MAX: i16 = <Microsecond as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Microsecond(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i16, BoundsError> {
        <Microsecond as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i16, BoundsError> {
        match const_check::i16(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Microsecond(err)),
        }
    }
    pub(crate) fn checked_add(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <Microsecond as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <Microsecond as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct Millisecond(());
impl Bounds for Millisecond {
    const WHAT: &'static str = jcore::bounds::Millisecond::WHAT;
    const MIN: Self::Primitive = jcore::bounds::Millisecond::MIN;
    const MAX: Self::Primitive = jcore::bounds::Millisecond::MAX;
    type Primitive = i16;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Millisecond {
    pub(crate) const MIN: i16 = <Millisecond as Bounds>::MIN;
    pub(crate) const MAX: i16 = <Millisecond as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Millisecond(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i16, BoundsError> {
        <Millisecond as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i16, BoundsError> {
        match const_check::i16(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Millisecond(err)),
        }
    }
    pub(crate) fn checked_add(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <Millisecond as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <Millisecond as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct Minute(());
impl Bounds for Minute {
    const WHAT: &'static str = jcore::bounds::Minute::WHAT;
    const MIN: Self::Primitive = jcore::bounds::Minute::MIN;
    const MAX: Self::Primitive = jcore::bounds::Minute::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Minute {
    pub(crate) const MIN: i8 = <Minute as Bounds>::MIN;
    pub(crate) const MAX: i8 = <Minute as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Minute(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <Minute as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Minute(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Minute as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Minute as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct Month(());
impl Bounds for Month {
    const WHAT: &'static str = jcore::bounds::Month::WHAT;
    const MIN: Self::Primitive = jcore::bounds::Month::MIN;
    const MAX: Self::Primitive = jcore::bounds::Month::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Month {
    pub(crate) const MIN: i8 = <Month as Bounds>::MIN;
    pub(crate) const MAX: i8 = <Month as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Month(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <Month as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Month(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Month as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Month as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct Nanosecond(());
impl Bounds for Nanosecond {
    const WHAT: &'static str = jcore::bounds::Nanosecond::WHAT;
    const MIN: Self::Primitive = jcore::bounds::Nanosecond::MIN;
    const MAX: Self::Primitive = jcore::bounds::Nanosecond::MAX;
    type Primitive = i16;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Nanosecond {
    pub(crate) const MIN: i16 = <Nanosecond as Bounds>::MIN;
    pub(crate) const MAX: i16 = <Nanosecond as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Nanosecond(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i16, BoundsError> {
        <Nanosecond as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i16, BoundsError> {
        match const_check::i16(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Nanosecond(err)),
        }
    }
    pub(crate) fn checked_add(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <Nanosecond as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <Nanosecond as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct NthWeekday(());
impl Bounds for NthWeekday {
    const WHAT: &'static str = jcore::bounds::NthWeekday::WHAT;
    const MIN: Self::Primitive = jcore::bounds::NthWeekday::MIN;
    const MAX: Self::Primitive = jcore::bounds::NthWeekday::MAX;
    type Primitive = i32;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl NthWeekday {
    pub(crate) const MIN: i32 = <NthWeekday as Bounds>::MIN;
    pub(crate) const MAX: i32 = <NthWeekday as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::NthWeekday(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i32, BoundsError> {
        <NthWeekday as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i32, BoundsError> {
        match const_check::i32(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::NthWeekday(err)),
        }
    }
    pub(crate) fn checked_add(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <NthWeekday as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <NthWeekday as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct OffsetHours(());
impl Bounds for OffsetHours {
    const WHAT: &'static str = jcore::bounds::OffsetHours::WHAT;
    const MIN: Self::Primitive = jcore::bounds::OffsetHours::MIN;
    const MAX: Self::Primitive = jcore::bounds::OffsetHours::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl OffsetHours {
    pub(crate) const MIN: i8 = <OffsetHours as Bounds>::MIN;
    pub(crate) const MAX: i8 = <OffsetHours as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::OffsetHours(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <OffsetHours as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::OffsetHours(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <OffsetHours as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <OffsetHours as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct OffsetMinutes(());
impl Bounds for OffsetMinutes {
    const WHAT: &'static str = jcore::bounds::OffsetMinutes::WHAT;
    const MIN: Self::Primitive = jcore::bounds::OffsetMinutes::MIN;
    const MAX: Self::Primitive = jcore::bounds::OffsetMinutes::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl OffsetMinutes {
    pub(crate) const MIN: i8 = <OffsetMinutes as Bounds>::MIN;
    pub(crate) const MAX: i8 = <OffsetMinutes as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::OffsetMinutes(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <OffsetMinutes as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::OffsetMinutes(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <OffsetMinutes as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <OffsetMinutes as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct OffsetSeconds(());
impl Bounds for OffsetSeconds {
    const WHAT: &'static str = jcore::bounds::OffsetSeconds::WHAT;
    const MIN: Self::Primitive = jcore::bounds::OffsetSeconds::MIN;
    const MAX: Self::Primitive = jcore::bounds::OffsetSeconds::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl OffsetSeconds {
    pub(crate) const MIN: i8 = <OffsetSeconds as Bounds>::MIN;
    pub(crate) const MAX: i8 = <OffsetSeconds as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::OffsetSeconds(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <OffsetSeconds as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::OffsetSeconds(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <OffsetSeconds as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <OffsetSeconds as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct OffsetTotalSeconds(());
impl Bounds for OffsetTotalSeconds {
    const WHAT: &'static str = jcore::bounds::OffsetTotalSeconds::WHAT;
    const MIN: Self::Primitive = jcore::bounds::OffsetTotalSeconds::MIN;
    const MAX: Self::Primitive = jcore::bounds::OffsetTotalSeconds::MAX;
    type Primitive = i32;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl OffsetTotalSeconds {
    pub(crate) const MIN: i32 = <OffsetTotalSeconds as Bounds>::MIN;
    pub(crate) const MAX: i32 = <OffsetTotalSeconds as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::OffsetTotalSeconds(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i32, BoundsError> {
        <OffsetTotalSeconds as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i32, BoundsError> {
        match const_check::i32(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::OffsetTotalSeconds(err)),
        }
    }
    pub(crate) fn checked_add(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <OffsetTotalSeconds as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <OffsetTotalSeconds as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct Second(());
impl Bounds for Second {
    const WHAT: &'static str = jcore::bounds::Second::WHAT;
    const MIN: Self::Primitive = jcore::bounds::Second::MIN;
    const MAX: Self::Primitive = jcore::bounds::Second::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Second {
    pub(crate) const MIN: i8 = <Second as Bounds>::MIN;
    pub(crate) const MAX: i8 = <Second as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Second(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <Second as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Second(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Second as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <Second as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SignedDurationSeconds(());
impl Bounds for SignedDurationSeconds {
    const WHAT: &'static str = "signed duration seconds";
    const MIN: Self::Primitive = i64::MIN;
    const MAX: Self::Primitive = i64::MAX;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SignedDurationSeconds {
    pub(crate) const MIN: i64 = <SignedDurationSeconds as Bounds>::MIN;
    pub(crate) const MAX: i64 = <SignedDurationSeconds as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SignedDurationSeconds(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <SignedDurationSeconds as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SignedDurationSeconds(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SignedDurationSeconds as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SignedDurationSeconds as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SpanYears(());
impl Bounds for SpanYears {
    const WHAT: &'static str = "years";
    const MIN: Self::Primitive = -Self::MAX;
    const MAX: Self::Primitive = (Year::LEN - 1) as i16;
    type Primitive = i16;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SpanYears {
    pub(crate) const MIN: i16 = <SpanYears as Bounds>::MIN;
    pub(crate) const MAX: i16 = <SpanYears as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SpanYears(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i16, BoundsError> {
        <SpanYears as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i16, BoundsError> {
        match const_check::i16(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SpanYears(err)),
        }
    }
    pub(crate) fn checked_add(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <SpanYears as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <SpanYears as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SpanMonths(());
impl Bounds for SpanMonths {
    const WHAT: &'static str = "months";
    const MIN: Self::Primitive = -Self::MAX;
    const MAX: Self::Primitive = SpanYears::MAX as i32 * 12;
    type Primitive = i32;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SpanMonths {
    pub(crate) const MIN: i32 = <SpanMonths as Bounds>::MIN;
    pub(crate) const MAX: i32 = <SpanMonths as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SpanMonths(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i32, BoundsError> {
        <SpanMonths as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i32, BoundsError> {
        match const_check::i32(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SpanMonths(err)),
        }
    }
    pub(crate) fn checked_add(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <SpanMonths as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <SpanMonths as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SpanWeeks(());
impl Bounds for SpanWeeks {
    const WHAT: &'static str = "weeks";
    const MIN: Self::Primitive = -Self::MAX;
    const MAX: Self::Primitive = SpanDays::MAX / c::DAYS_PER_CIVIL_WEEK_32;
    type Primitive = i32;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SpanWeeks {
    pub(crate) const MIN: i32 = <SpanWeeks as Bounds>::MIN;
    pub(crate) const MAX: i32 = <SpanWeeks as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SpanWeeks(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i32, BoundsError> {
        <SpanWeeks as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i32, BoundsError> {
        match const_check::i32(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SpanWeeks(err)),
        }
    }
    pub(crate) fn checked_add(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <SpanWeeks as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <SpanWeeks as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SpanDays(());
impl Bounds for SpanDays {
    const WHAT: &'static str = "days";
    const MIN: Self::Primitive = -Self::MAX;
    const MAX: Self::Primitive = SpanHours::MAX / c::HOURS_PER_CIVIL_DAY_32;
    type Primitive = i32;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SpanDays {
    pub(crate) const MIN: i32 = <SpanDays as Bounds>::MIN;
    pub(crate) const MAX: i32 = <SpanDays as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SpanDays(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i32, BoundsError> {
        <SpanDays as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i32, BoundsError> {
        match const_check::i32(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SpanDays(err)),
        }
    }
    pub(crate) fn checked_add(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <SpanDays as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <SpanDays as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SpanHours(());
impl Bounds for SpanHours {
    const WHAT: &'static str = "hours";
    const MIN: Self::Primitive = -Self::MAX;
    const MAX: Self::Primitive = (SpanMinutes::MAX / c::MINS_PER_HOUR) as i32;
    type Primitive = i32;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SpanHours {
    pub(crate) const MIN: i32 = <SpanHours as Bounds>::MIN;
    pub(crate) const MAX: i32 = <SpanHours as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SpanHours(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i32, BoundsError> {
        <SpanHours as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i32, BoundsError> {
        match const_check::i32(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SpanHours(err)),
        }
    }
    pub(crate) fn checked_add(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <SpanHours as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <SpanHours as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SpanMinutes(());
impl Bounds for SpanMinutes {
    const WHAT: &'static str = "minutes";
    const MIN: Self::Primitive = -Self::MAX;
    const MAX: Self::Primitive = SpanSeconds::MAX / c::SECS_PER_MIN;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SpanMinutes {
    pub(crate) const MIN: i64 = <SpanMinutes as Bounds>::MIN;
    pub(crate) const MAX: i64 = <SpanMinutes as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SpanMinutes(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <SpanMinutes as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SpanMinutes(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SpanMinutes as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SpanMinutes as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SpanSeconds(());
impl Bounds for SpanSeconds {
    const WHAT: &'static str = "seconds";
    const MIN: Self::Primitive = bounds::DeltaSeconds::MIN;
    const MAX: Self::Primitive = bounds::DeltaSeconds::MAX;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SpanSeconds {
    pub(crate) const MIN: i64 = <SpanSeconds as Bounds>::MIN;
    pub(crate) const MAX: i64 = <SpanSeconds as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SpanSeconds(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <SpanSeconds as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SpanSeconds(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SpanSeconds as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SpanSeconds as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SpanMilliseconds(());
impl Bounds for SpanMilliseconds {
    const WHAT: &'static str = "milliseconds";
    const MIN: Self::Primitive = -Self::MAX;
    const MAX: Self::Primitive = SpanSeconds::MAX * c::MILLIS_PER_SEC;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SpanMilliseconds {
    pub(crate) const MIN: i64 = <SpanMilliseconds as Bounds>::MIN;
    pub(crate) const MAX: i64 = <SpanMilliseconds as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SpanMilliseconds(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <SpanMilliseconds as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SpanMilliseconds(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SpanMilliseconds as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SpanMilliseconds as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SpanMicroseconds(());
impl Bounds for SpanMicroseconds {
    const WHAT: &'static str = "microseconds";
    const MIN: Self::Primitive = -Self::MAX;
    const MAX: Self::Primitive = SpanMilliseconds::MAX * c::MICROS_PER_MILLI;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SpanMicroseconds {
    pub(crate) const MIN: i64 = <SpanMicroseconds as Bounds>::MIN;
    pub(crate) const MAX: i64 = <SpanMicroseconds as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SpanMicroseconds(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <SpanMicroseconds as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SpanMicroseconds(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SpanMicroseconds as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SpanMicroseconds as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SpanMultiple(());
impl Bounds for SpanMultiple {
    const WHAT: &'static str = "span multiple";
    const MIN: Self::Primitive = i64::MIN + 1;
    const MAX: Self::Primitive = i64::MAX;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SpanMultiple {
    pub(crate) const MIN: i64 = <SpanMultiple as Bounds>::MIN;
    pub(crate) const MAX: i64 = <SpanMultiple as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SpanMultiple(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <SpanMultiple as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SpanMultiple(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SpanMultiple as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SpanMultiple as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SpanNanoseconds(());
impl Bounds for SpanNanoseconds {
    const WHAT: &'static str = "nanoseconds";
    const MIN: Self::Primitive = i64::MIN + 1;
    const MAX: Self::Primitive = i64::MAX;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SpanNanoseconds {
    pub(crate) const MIN: i64 = <SpanNanoseconds as Bounds>::MIN;
    pub(crate) const MAX: i64 = <SpanNanoseconds as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SpanNanoseconds(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <SpanNanoseconds as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SpanNanoseconds(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SpanNanoseconds as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <SpanNanoseconds as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SubsecNanosecond(());
impl Bounds for SubsecNanosecond {
    const WHAT: &'static str = jcore::bounds::SubsecNanosecond::WHAT;
    const MIN: Self::Primitive = jcore::bounds::SubsecNanosecond::MIN;
    const MAX: Self::Primitive = jcore::bounds::SubsecNanosecond::MAX;
    type Primitive = i32;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SubsecNanosecond {
    pub(crate) const MIN: i32 = <SubsecNanosecond as Bounds>::MIN;
    pub(crate) const MAX: i32 = <SubsecNanosecond as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SubsecNanosecond(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i32, BoundsError> {
        <SubsecNanosecond as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i32, BoundsError> {
        match const_check::i32(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SubsecNanosecond(err)),
        }
    }
    pub(crate) fn checked_add(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <SubsecNanosecond as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <SubsecNanosecond as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct SignedSubsecNanosecond(());
impl Bounds for SignedSubsecNanosecond {
    const WHAT: &'static str = jcore::bounds::SignedSubsecNanosecond::WHAT;
    const MIN: Self::Primitive = jcore::bounds::SignedSubsecNanosecond::MIN;
    const MAX: Self::Primitive = jcore::bounds::SignedSubsecNanosecond::MAX;
    type Primitive = i32;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl SignedSubsecNanosecond {
    pub(crate) const MIN: i32 = <SignedSubsecNanosecond as Bounds>::MIN;
    pub(crate) const MAX: i32 = <SignedSubsecNanosecond as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::SignedSubsecNanosecond(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i32, BoundsError> {
        <SignedSubsecNanosecond as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i32, BoundsError> {
        match const_check::i32(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::SignedSubsecNanosecond(err)),
        }
    }
    pub(crate) fn checked_add(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <SignedSubsecNanosecond as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <SignedSubsecNanosecond as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct UnixEpochDays(());
impl Bounds for UnixEpochDays {
    const WHAT: &'static str = jcore::bounds::UnixEpochDays::WHAT;
    const MIN: Self::Primitive = jcore::bounds::UnixEpochDays::MIN;
    const MAX: Self::Primitive = jcore::bounds::UnixEpochDays::MAX;
    type Primitive = i32;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl UnixEpochDays {
    pub(crate) const MIN: i32 = <UnixEpochDays as Bounds>::MIN;
    pub(crate) const MAX: i32 = <UnixEpochDays as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::UnixEpochDays(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i32, BoundsError> {
        <UnixEpochDays as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i32, BoundsError> {
        match const_check::i32(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::UnixEpochDays(err)),
        }
    }
    pub(crate) fn checked_add(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <UnixEpochDays as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <UnixEpochDays as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct UnixEpochMilliseconds(());
impl Bounds for UnixEpochMilliseconds {
    const WHAT: &'static str = jcore::bounds::UnixEpochMilliseconds::WHAT;
    const MIN: Self::Primitive = jcore::bounds::UnixEpochMilliseconds::MIN;
    const MAX: Self::Primitive = jcore::bounds::UnixEpochMilliseconds::MAX;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl UnixEpochMilliseconds {
    pub(crate) const MIN: i64 = <UnixEpochMilliseconds as Bounds>::MIN;
    pub(crate) const MAX: i64 = <UnixEpochMilliseconds as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::UnixEpochMilliseconds(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <UnixEpochMilliseconds as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::UnixEpochMilliseconds(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <UnixEpochMilliseconds as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <UnixEpochMilliseconds as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct UnixEpochMicroseconds(());
impl Bounds for UnixEpochMicroseconds {
    const WHAT: &'static str = jcore::bounds::UnixEpochMicroseconds::WHAT;
    const MIN: Self::Primitive = jcore::bounds::UnixEpochMicroseconds::MIN;
    const MAX: Self::Primitive = jcore::bounds::UnixEpochMicroseconds::MAX;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl UnixEpochMicroseconds {
    pub(crate) const MIN: i64 = <UnixEpochMicroseconds as Bounds>::MIN;
    pub(crate) const MAX: i64 = <UnixEpochMicroseconds as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::UnixEpochMicroseconds(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <UnixEpochMicroseconds as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::UnixEpochMicroseconds(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <UnixEpochMicroseconds as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <UnixEpochMicroseconds as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct UnixEpochSeconds(());
impl Bounds for UnixEpochSeconds {
    const WHAT: &'static str = jcore::bounds::UnixEpochSeconds::WHAT;
    const MIN: Self::Primitive = jcore::bounds::UnixEpochSeconds::MIN;
    const MAX: Self::Primitive = jcore::bounds::UnixEpochSeconds::MAX;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl UnixEpochSeconds {
    pub(crate) const MIN: i64 = <UnixEpochSeconds as Bounds>::MIN;
    pub(crate) const MAX: i64 = <UnixEpochSeconds as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::UnixEpochSeconds(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <UnixEpochSeconds as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::UnixEpochSeconds(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <UnixEpochSeconds as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <UnixEpochSeconds as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct WeekNum(());
impl Bounds for WeekNum {
    const WHAT: &'static str = "week-number";
    const MIN: Self::Primitive = 0;
    const MAX: Self::Primitive = 53;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl WeekNum {
    pub(crate) const MIN: i8 = <WeekNum as Bounds>::MIN;
    pub(crate) const MAX: i8 = <WeekNum as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::WeekNum(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <WeekNum as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::WeekNum(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <WeekNum as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <WeekNum as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct WeekdayMondayZero(());
impl Bounds for WeekdayMondayZero {
    const WHAT: &'static str = jcore::bounds::WeekdayMondayZero::WHAT;
    const MIN: Self::Primitive = jcore::bounds::WeekdayMondayZero::MIN;
    const MAX: Self::Primitive = jcore::bounds::WeekdayMondayZero::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl WeekdayMondayZero {
    pub(crate) const MIN: i8 = <WeekdayMondayZero as Bounds>::MIN;
    pub(crate) const MAX: i8 = <WeekdayMondayZero as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::WeekdayMondayZero(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <WeekdayMondayZero as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::WeekdayMondayZero(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <WeekdayMondayZero as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <WeekdayMondayZero as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct WeekdayMondayOne(());
impl Bounds for WeekdayMondayOne {
    const WHAT: &'static str = jcore::bounds::WeekdayMondayOne::WHAT;
    const MIN: Self::Primitive = jcore::bounds::WeekdayMondayOne::MIN;
    const MAX: Self::Primitive = jcore::bounds::WeekdayMondayOne::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl WeekdayMondayOne {
    pub(crate) const MIN: i8 = <WeekdayMondayOne as Bounds>::MIN;
    pub(crate) const MAX: i8 = <WeekdayMondayOne as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::WeekdayMondayOne(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <WeekdayMondayOne as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::WeekdayMondayOne(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <WeekdayMondayOne as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <WeekdayMondayOne as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct WeekdaySundayZero(());
impl Bounds for WeekdaySundayZero {
    const WHAT: &'static str = jcore::bounds::WeekdaySundayZero::WHAT;
    const MIN: Self::Primitive = jcore::bounds::WeekdaySundayZero::MIN;
    const MAX: Self::Primitive = jcore::bounds::WeekdaySundayZero::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl WeekdaySundayZero {
    pub(crate) const MIN: i8 = <WeekdaySundayZero as Bounds>::MIN;
    pub(crate) const MAX: i8 = <WeekdaySundayZero as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::WeekdaySundayZero(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <WeekdaySundayZero as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::WeekdaySundayZero(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <WeekdaySundayZero as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <WeekdaySundayZero as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct WeekdaySundayOne(());
impl Bounds for WeekdaySundayOne {
    const WHAT: &'static str = jcore::bounds::WeekdaySundayOne::WHAT;
    const MIN: Self::Primitive = jcore::bounds::WeekdaySundayOne::MIN;
    const MAX: Self::Primitive = jcore::bounds::WeekdaySundayOne::MAX;
    type Primitive = i8;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl WeekdaySundayOne {
    pub(crate) const MIN: i8 = <WeekdaySundayOne as Bounds>::MIN;
    pub(crate) const MAX: i8 = <WeekdaySundayOne as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::WeekdaySundayOne(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i8, BoundsError> {
        <WeekdaySundayOne as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i8, BoundsError> {
        match const_check::i8(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::WeekdaySundayOne(err)),
        }
    }
    pub(crate) fn checked_add(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <WeekdaySundayOne as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i8, n2: i8) -> Result<i8, BoundsError> {
        <WeekdaySundayOne as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct Year(());
impl Bounds for Year {
    const WHAT: &'static str = jcore::bounds::Year::WHAT;
    const MIN: Self::Primitive = jcore::bounds::Year::MIN;
    const MAX: Self::Primitive = jcore::bounds::Year::MAX;
    type Primitive = i16;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl Year {
    pub(crate) const MIN: i16 = <Year as Bounds>::MIN;
    pub(crate) const MAX: i16 = <Year as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::Year(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i16, BoundsError> {
        <Year as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i16, BoundsError> {
        match const_check::i16(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::Year(err)),
        }
    }
    pub(crate) fn checked_add(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <Year as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <Year as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct YearCE(());
impl Bounds for YearCE {
    const WHAT: &'static str = jcore::bounds::YearCE::WHAT;
    const MIN: Self::Primitive = jcore::bounds::YearCE::MIN;
    const MAX: Self::Primitive = jcore::bounds::YearCE::MAX;
    type Primitive = i16;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl YearCE {
    pub(crate) const MIN: i16 = <YearCE as Bounds>::MIN;
    pub(crate) const MAX: i16 = <YearCE as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::YearCE(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i16, BoundsError> {
        <YearCE as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i16, BoundsError> {
        match const_check::i16(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::YearCE(err)),
        }
    }
    pub(crate) fn checked_add(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <YearCE as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <YearCE as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct YearBCE(());
impl Bounds for YearBCE {
    const WHAT: &'static str = jcore::bounds::YearBCE::WHAT;
    const MIN: Self::Primitive = jcore::bounds::YearBCE::MIN;
    const MAX: Self::Primitive = jcore::bounds::YearBCE::MAX;
    type Primitive = i16;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl YearBCE {
    pub(crate) const MIN: i16 = <YearBCE as Bounds>::MIN;
    pub(crate) const MAX: i16 = <YearBCE as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::YearBCE(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i16, BoundsError> {
        <YearBCE as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i16, BoundsError> {
        match const_check::i16(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::YearBCE(err)),
        }
    }
    pub(crate) fn checked_add(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <YearBCE as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <YearBCE as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct YearTwoDigit(());
impl Bounds for YearTwoDigit {
    const WHAT: &'static str = "year (2 digits)";
    const MIN: Self::Primitive = 0;
    const MAX: Self::Primitive = 99;
    type Primitive = i16;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl YearTwoDigit {
    pub(crate) const MIN: i16 = <YearTwoDigit as Bounds>::MIN;
    pub(crate) const MAX: i16 = <YearTwoDigit as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::YearTwoDigit(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i16, BoundsError> {
        <YearTwoDigit as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i16, BoundsError> {
        match const_check::i16(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::YearTwoDigit(err)),
        }
    }
    pub(crate) fn checked_add(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <YearTwoDigit as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i16, n2: i16) -> Result<i16, BoundsError> {
        <YearTwoDigit as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct ZonedDateTimeDayNanoseconds(());
impl Bounds for ZonedDateTimeDayNanoseconds {
    const WHAT: &'static str = "nanoseconds (in one zoned datetime day)";
    const MIN: Self::Primitive =
        ZonedDateTimeDaySeconds::MIN as i64 * c::NANOS_PER_SEC;
    const MAX: Self::Primitive =
        ZonedDateTimeDaySeconds::MAX as i64 * c::NANOS_PER_SEC;
    type Primitive = i64;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl ZonedDateTimeDayNanoseconds {
    pub(crate) const MIN: i64 = <ZonedDateTimeDayNanoseconds as Bounds>::MIN;
    pub(crate) const MAX: i64 = <ZonedDateTimeDayNanoseconds as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::ZonedDateTimeDayNanoseconds(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i64, BoundsError> {
        <ZonedDateTimeDayNanoseconds as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i64, BoundsError> {
        match const_check::i64(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::ZonedDateTimeDayNanoseconds(err)),
        }
    }
    pub(crate) fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <ZonedDateTimeDayNanoseconds as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError> {
        <ZonedDateTimeDayNanoseconds as Bounds>::checked_mul(n1, n2)
    }
}
pub(crate) struct ZonedDateTimeDaySeconds(());
impl Bounds for ZonedDateTimeDaySeconds {
    const WHAT: &'static str = "seconds (in one zoned datetime day)";
    const MIN: Self::Primitive = 1;
    const MAX: Self::Primitive = 7 * c::SECS_PER_CIVIL_DAY_32;
    type Primitive = i32;
    type Error = BoundsError;
    #[cold]
    #[inline(never)]
    fn error() -> BoundsError { Self::error() }
}
#[allow(dead_code)]
impl ZonedDateTimeDaySeconds {
    pub(crate) const MIN: i32 = <ZonedDateTimeDaySeconds as Bounds>::MIN;
    pub(crate) const MAX: i32 = <ZonedDateTimeDaySeconds as Bounds>::MAX;
    const LEN: i128 = Self::MAX as i128 - Self::MIN as i128 + 1;
    #[cold]
    pub(crate) const fn error() -> BoundsError {
        BoundsError::ZonedDateTimeDaySeconds(RawBoundsError::new())
    }
    pub(crate) fn check(n: impl Into<i64>) -> Result<i32, BoundsError> {
        <ZonedDateTimeDaySeconds as Bounds>::check(n)
    }
    pub(crate) const fn checkc(n: i64) -> Result<i32, BoundsError> {
        match const_check::i32(n) {
            Ok(n) => Ok(n),
            Err(err) => Err(BoundsError::ZonedDateTimeDaySeconds(err)),
        }
    }
    pub(crate) fn checked_add(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <ZonedDateTimeDaySeconds as Bounds>::checked_add(n1, n2)
    }
    pub(crate) fn checked_mul(n1: i32, n2: i32) -> Result<i32, BoundsError> {
        <ZonedDateTimeDaySeconds as Bounds>::checked_mul(n1, n2)
    }
}
/// An error that indicates a value is out of its intended range.
pub(crate) enum BoundsError {
    Century(RawBoundsError<Century>),
    CivilDayNanosecond(RawBoundsError<CivilDayNanosecond>),
    CivilDaySecond(RawBoundsError<CivilDaySecond>),
    Day(RawBoundsError<Day>),
    DayOfYear(RawBoundsError<DayOfYear>),
    Hour(RawBoundsError<Hour>),
    Hour12(RawBoundsError<Hour12>),
    ISOWeek(RawBoundsError<ISOWeek>),
    ISOYear(RawBoundsError<ISOYear>),
    Increment(RawBoundsError<Increment>),
    Increment32(RawBoundsError<Increment32>),
    LeapSecond(RawBoundsError<LeapSecond>),
    Microsecond(RawBoundsError<Microsecond>),
    Millisecond(RawBoundsError<Millisecond>),
    Minute(RawBoundsError<Minute>),
    Month(RawBoundsError<Month>),
    Nanosecond(RawBoundsError<Nanosecond>),
    NthWeekday(RawBoundsError<NthWeekday>),
    OffsetHours(RawBoundsError<OffsetHours>),
    OffsetMinutes(RawBoundsError<OffsetMinutes>),
    OffsetSeconds(RawBoundsError<OffsetSeconds>),
    OffsetTotalSeconds(RawBoundsError<OffsetTotalSeconds>),
    Second(RawBoundsError<Second>),
    SignedDurationSeconds(RawBoundsError<SignedDurationSeconds>),
    SpanYears(RawBoundsError<SpanYears>),
    SpanMonths(RawBoundsError<SpanMonths>),
    SpanWeeks(RawBoundsError<SpanWeeks>),
    SpanDays(RawBoundsError<SpanDays>),
    SpanHours(RawBoundsError<SpanHours>),
    SpanMinutes(RawBoundsError<SpanMinutes>),
    SpanSeconds(RawBoundsError<SpanSeconds>),
    SpanMilliseconds(RawBoundsError<SpanMilliseconds>),
    SpanMicroseconds(RawBoundsError<SpanMicroseconds>),
    SpanMultiple(RawBoundsError<SpanMultiple>),
    SpanNanoseconds(RawBoundsError<SpanNanoseconds>),
    SubsecNanosecond(RawBoundsError<SubsecNanosecond>),
    SignedSubsecNanosecond(RawBoundsError<SignedSubsecNanosecond>),
    UnixEpochDays(RawBoundsError<UnixEpochDays>),
    UnixEpochMilliseconds(RawBoundsError<UnixEpochMilliseconds>),
    UnixEpochMicroseconds(RawBoundsError<UnixEpochMicroseconds>),
    UnixEpochSeconds(RawBoundsError<UnixEpochSeconds>),
    WeekNum(RawBoundsError<WeekNum>),
    WeekdayMondayZero(RawBoundsError<WeekdayMondayZero>),
    WeekdayMondayOne(RawBoundsError<WeekdayMondayOne>),
    WeekdaySundayZero(RawBoundsError<WeekdaySundayZero>),
    WeekdaySundayOne(RawBoundsError<WeekdaySundayOne>),
    Year(RawBoundsError<Year>),
    YearCE(RawBoundsError<YearCE>),
    YearBCE(RawBoundsError<YearBCE>),
    YearTwoDigit(RawBoundsError<YearTwoDigit>),
    ZonedDateTimeDayNanoseconds(RawBoundsError<ZonedDateTimeDayNanoseconds>),
    ZonedDateTimeDaySeconds(RawBoundsError<ZonedDateTimeDaySeconds>),
}
#[automatically_derived]impl ::core::clone::Clone for BoundsError {
    #[inline]
    #[rustc_trivial_field_reads]
    fn clone(&self) -> Self {
        match self {
            Self::Century(__self_0) =>
                BoundsError::Century(::core::clone::Clone::clone(__self_0)),
            Self::CivilDayNanosecond(__self_0) =>
                BoundsError::CivilDayNanosecond(::core::clone::Clone::clone(__self_0)),
            Self::CivilDaySecond(__self_0) =>
                BoundsError::CivilDaySecond(::core::clone::Clone::clone(__self_0)),
            Self::Day(__self_0) =>
                BoundsError::Day(::core::clone::Clone::clone(__self_0)),
            Self::DayOfYear(__self_0) =>
                BoundsError::DayOfYear(::core::clone::Clone::clone(__self_0)),
            Self::Hour(__self_0) =>
                BoundsError::Hour(::core::clone::Clone::clone(__self_0)),
            Self::Hour12(__self_0) =>
                BoundsError::Hour12(::core::clone::Clone::clone(__self_0)),
            Self::ISOWeek(__self_0) =>
                BoundsError::ISOWeek(::core::clone::Clone::clone(__self_0)),
            Self::ISOYear(__self_0) =>
                BoundsError::ISOYear(::core::clone::Clone::clone(__self_0)),
            Self::Increment(__self_0) =>
                BoundsError::Increment(::core::clone::Clone::clone(__self_0)),
            Self::Increment32(__self_0) =>
                BoundsError::Increment32(::core::clone::Clone::clone(__self_0)),
            Self::LeapSecond(__self_0) =>
                BoundsError::LeapSecond(::core::clone::Clone::clone(__self_0)),
            Self::Microsecond(__self_0) =>
                BoundsError::Microsecond(::core::clone::Clone::clone(__self_0)),
            Self::Millisecond(__self_0) =>
                BoundsError::Millisecond(::core::clone::Clone::clone(__self_0)),
            Self::Minute(__self_0) =>
                BoundsError::Minute(::core::clone::Clone::clone(__self_0)),
            Self::Month(__self_0) =>
                BoundsError::Month(::core::clone::Clone::clone(__self_0)),
            Self::Nanosecond(__self_0) =>
                BoundsError::Nanosecond(::core::clone::Clone::clone(__self_0)),
            Self::NthWeekday(__self_0) =>
                BoundsError::NthWeekday(::core::clone::Clone::clone(__self_0)),
            Self::OffsetHours(__self_0) =>
                BoundsError::OffsetHours(::core::clone::Clone::clone(__self_0)),
            Self::OffsetMinutes(__self_0) =>
                BoundsError::OffsetMinutes(::core::clone::Clone::clone(__self_0)),
            Self::OffsetSeconds(__self_0) =>
                BoundsError::OffsetSeconds(::core::clone::Clone::clone(__self_0)),
            Self::OffsetTotalSeconds(__self_0) =>
                BoundsError::OffsetTotalSeconds(::core::clone::Clone::clone(__self_0)),
            Self::Second(__self_0) =>
                BoundsError::Second(::core::clone::Clone::clone(__self_0)),
            Self::SignedDurationSeconds(__self_0) =>
                BoundsError::SignedDurationSeconds(::core::clone::Clone::clone(__self_0)),
            Self::SpanYears(__self_0) =>
                BoundsError::SpanYears(::core::clone::Clone::clone(__self_0)),
            Self::SpanMonths(__self_0) =>
                BoundsError::SpanMonths(::core::clone::Clone::clone(__self_0)),
            Self::SpanWeeks(__self_0) =>
                BoundsError::SpanWeeks(::core::clone::Clone::clone(__self_0)),
            Self::SpanDays(__self_0) =>
                BoundsError::SpanDays(::core::clone::Clone::clone(__self_0)),
            Self::SpanHours(__self_0) =>
                BoundsError::SpanHours(::core::clone::Clone::clone(__self_0)),
            Self::SpanMinutes(__self_0) =>
                BoundsError::SpanMinutes(::core::clone::Clone::clone(__self_0)),
            Self::SpanSeconds(__self_0) =>
                BoundsError::SpanSeconds(::core::clone::Clone::clone(__self_0)),
            Self::SpanMilliseconds(__self_0) =>
                BoundsError::SpanMilliseconds(::core::clone::Clone::clone(__self_0)),
            Self::SpanMicroseconds(__self_0) =>
                BoundsError::SpanMicroseconds(::core::clone::Clone::clone(__self_0)),
            Self::SpanMultiple(__self_0) =>
                BoundsError::SpanMultiple(::core::clone::Clone::clone(__self_0)),
            Self::SpanNanoseconds(__self_0) =>
                BoundsError::SpanNanoseconds(::core::clone::Clone::clone(__self_0)),
            Self::SubsecNanosecond(__self_0) =>
                BoundsError::SubsecNanosecond(::core::clone::Clone::clone(__self_0)),
            Self::SignedSubsecNanosecond(__self_0) =>
                BoundsError::SignedSubsecNanosecond(::core::clone::Clone::clone(__self_0)),
            Self::UnixEpochDays(__self_0) =>
                BoundsError::UnixEpochDays(::core::clone::Clone::clone(__self_0)),
            Self::UnixEpochMilliseconds(__self_0) =>
                BoundsError::UnixEpochMilliseconds(::core::clone::Clone::clone(__self_0)),
            Self::UnixEpochMicroseconds(__self_0) =>
                BoundsError::UnixEpochMicroseconds(::core::clone::Clone::clone(__self_0)),
            Self::UnixEpochSeconds(__self_0) =>
                BoundsError::UnixEpochSeconds(::core::clone::Clone::clone(__self_0)),
            Self::WeekNum(__self_0) =>
                BoundsError::WeekNum(::core::clone::Clone::clone(__self_0)),
            Self::WeekdayMondayZero(__self_0) =>
                BoundsError::WeekdayMondayZero(::core::clone::Clone::clone(__self_0)),
            Self::WeekdayMondayOne(__self_0) =>
                BoundsError::WeekdayMondayOne(::core::clone::Clone::clone(__self_0)),
            Self::WeekdaySundayZero(__self_0) =>
                BoundsError::WeekdaySundayZero(::core::clone::Clone::clone(__self_0)),
            Self::WeekdaySundayOne(__self_0) =>
                BoundsError::WeekdaySundayOne(::core::clone::Clone::clone(__self_0)),
            Self::Year(__self_0) =>
                BoundsError::Year(::core::clone::Clone::clone(__self_0)),
            Self::YearCE(__self_0) =>
                BoundsError::YearCE(::core::clone::Clone::clone(__self_0)),
            Self::YearBCE(__self_0) =>
                BoundsError::YearBCE(::core::clone::Clone::clone(__self_0)),
            Self::YearTwoDigit(__self_0) =>
                BoundsError::YearTwoDigit(::core::clone::Clone::clone(__self_0)),
            Self::ZonedDateTimeDayNanoseconds(__self_0) =>
                BoundsError::ZonedDateTimeDayNanoseconds(::core::clone::Clone::clone(__self_0)),
            Self::ZonedDateTimeDaySeconds(__self_0) =>
                BoundsError::ZonedDateTimeDaySeconds(::core::clone::Clone::clone(__self_0)),
        }
    }
}
#[automatically_derived]impl ::core::fmt::Debug for BoundsError {
    #[inline]
    #[rustc_trivial_field_reads]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Century(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Century", &__self_0),
            Self::CivilDayNanosecond(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "CivilDayNanosecond", &__self_0),
            Self::CivilDaySecond(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "CivilDaySecond", &__self_0),
            Self::Day(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Day",
                    &__self_0),
            Self::DayOfYear(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "DayOfYear", &__self_0),
            Self::Hour(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Hour",
                    &__self_0),
            Self::Hour12(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Hour12", &__self_0),
            Self::ISOWeek(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "ISOWeek", &__self_0),
            Self::ISOYear(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "ISOYear", &__self_0),
            Self::Increment(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Increment", &__self_0),
            Self::Increment32(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Increment32", &__self_0),
            Self::LeapSecond(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "LeapSecond", &__self_0),
            Self::Microsecond(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Microsecond", &__self_0),
            Self::Millisecond(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Millisecond", &__self_0),
            Self::Minute(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Minute", &__self_0),
            Self::Month(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Month",
                    &__self_0),
            Self::Nanosecond(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Nanosecond", &__self_0),
            Self::NthWeekday(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "NthWeekday", &__self_0),
            Self::OffsetHours(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "OffsetHours", &__self_0),
            Self::OffsetMinutes(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "OffsetMinutes", &__self_0),
            Self::OffsetSeconds(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "OffsetSeconds", &__self_0),
            Self::OffsetTotalSeconds(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "OffsetTotalSeconds", &__self_0),
            Self::Second(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Second", &__self_0),
            Self::SignedDurationSeconds(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SignedDurationSeconds", &__self_0),
            Self::SpanYears(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SpanYears", &__self_0),
            Self::SpanMonths(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SpanMonths", &__self_0),
            Self::SpanWeeks(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SpanWeeks", &__self_0),
            Self::SpanDays(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SpanDays", &__self_0),
            Self::SpanHours(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SpanHours", &__self_0),
            Self::SpanMinutes(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SpanMinutes", &__self_0),
            Self::SpanSeconds(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SpanSeconds", &__self_0),
            Self::SpanMilliseconds(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SpanMilliseconds", &__self_0),
            Self::SpanMicroseconds(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SpanMicroseconds", &__self_0),
            Self::SpanMultiple(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SpanMultiple", &__self_0),
            Self::SpanNanoseconds(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SpanNanoseconds", &__self_0),
            Self::SubsecNanosecond(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SubsecNanosecond", &__self_0),
            Self::SignedSubsecNanosecond(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "SignedSubsecNanosecond", &__self_0),
            Self::UnixEpochDays(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "UnixEpochDays", &__self_0),
            Self::UnixEpochMilliseconds(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "UnixEpochMilliseconds", &__self_0),
            Self::UnixEpochMicroseconds(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "UnixEpochMicroseconds", &__self_0),
            Self::UnixEpochSeconds(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "UnixEpochSeconds", &__self_0),
            Self::WeekNum(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "WeekNum", &__self_0),
            Self::WeekdayMondayZero(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "WeekdayMondayZero", &__self_0),
            Self::WeekdayMondayOne(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "WeekdayMondayOne", &__self_0),
            Self::WeekdaySundayZero(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "WeekdaySundayZero", &__self_0),
            Self::WeekdaySundayOne(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "WeekdaySundayOne", &__self_0),
            Self::Year(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Year",
                    &__self_0),
            Self::YearCE(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "YearCE", &__self_0),
            Self::YearBCE(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "YearBCE", &__self_0),
            Self::YearTwoDigit(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "YearTwoDigit", &__self_0),
            Self::ZonedDateTimeDayNanoseconds(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "ZonedDateTimeDayNanoseconds", &__self_0),
            Self::ZonedDateTimeDaySeconds(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "ZonedDateTimeDaySeconds", &__self_0),
        }
    }
}
impl core::fmt::Display for BoundsError {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        match *self {
            BoundsError::Century(ref err) => err.fmt(f),
            BoundsError::CivilDayNanosecond(ref err) => err.fmt(f),
            BoundsError::CivilDaySecond(ref err) => err.fmt(f),
            BoundsError::Day(ref err) => err.fmt(f),
            BoundsError::DayOfYear(ref err) => err.fmt(f),
            BoundsError::Hour(ref err) => err.fmt(f),
            BoundsError::Hour12(ref err) => err.fmt(f),
            BoundsError::ISOWeek(ref err) => err.fmt(f),
            BoundsError::ISOYear(ref err) => err.fmt(f),
            BoundsError::Increment(ref err) => err.fmt(f),
            BoundsError::Increment32(ref err) => err.fmt(f),
            BoundsError::LeapSecond(ref err) => err.fmt(f),
            BoundsError::Microsecond(ref err) => err.fmt(f),
            BoundsError::Millisecond(ref err) => err.fmt(f),
            BoundsError::Minute(ref err) => err.fmt(f),
            BoundsError::Month(ref err) => err.fmt(f),
            BoundsError::Nanosecond(ref err) => err.fmt(f),
            BoundsError::NthWeekday(ref err) => err.fmt(f),
            BoundsError::OffsetHours(ref err) => err.fmt(f),
            BoundsError::OffsetMinutes(ref err) => err.fmt(f),
            BoundsError::OffsetSeconds(ref err) => err.fmt(f),
            BoundsError::OffsetTotalSeconds(ref err) => err.fmt(f),
            BoundsError::Second(ref err) => err.fmt(f),
            BoundsError::SignedDurationSeconds(ref err) => err.fmt(f),
            BoundsError::SpanYears(ref err) => err.fmt(f),
            BoundsError::SpanMonths(ref err) => err.fmt(f),
            BoundsError::SpanWeeks(ref err) => err.fmt(f),
            BoundsError::SpanDays(ref err) => err.fmt(f),
            BoundsError::SpanHours(ref err) => err.fmt(f),
            BoundsError::SpanMinutes(ref err) => err.fmt(f),
            BoundsError::SpanSeconds(ref err) => err.fmt(f),
            BoundsError::SpanMilliseconds(ref err) => err.fmt(f),
            BoundsError::SpanMicroseconds(ref err) => err.fmt(f),
            BoundsError::SpanMultiple(ref err) => err.fmt(f),
            BoundsError::SpanNanoseconds(ref err) => err.fmt(f),
            BoundsError::SubsecNanosecond(ref err) => err.fmt(f),
            BoundsError::SignedSubsecNanosecond(ref err) => err.fmt(f),
            BoundsError::UnixEpochDays(ref err) => err.fmt(f),
            BoundsError::UnixEpochMilliseconds(ref err) => err.fmt(f),
            BoundsError::UnixEpochMicroseconds(ref err) => err.fmt(f),
            BoundsError::UnixEpochSeconds(ref err) => err.fmt(f),
            BoundsError::WeekNum(ref err) => err.fmt(f),
            BoundsError::WeekdayMondayZero(ref err) => err.fmt(f),
            BoundsError::WeekdayMondayOne(ref err) => err.fmt(f),
            BoundsError::WeekdaySundayZero(ref err) => err.fmt(f),
            BoundsError::WeekdaySundayOne(ref err) => err.fmt(f),
            BoundsError::Year(ref err) => err.fmt(f),
            BoundsError::YearCE(ref err) => err.fmt(f),
            BoundsError::YearBCE(ref err) => err.fmt(f),
            BoundsError::YearTwoDigit(ref err) => err.fmt(f),
            BoundsError::ZonedDateTimeDayNanoseconds(ref err) => err.fmt(f),
            BoundsError::ZonedDateTimeDaySeconds(ref err) => err.fmt(f),
        }
    }
}define_bounds! {
166    (Century, i8, "century", 0, 99),
167    (CivilDayNanosecond, i64),
168    (CivilDaySecond, i32),
169    (Day, i8),
170    (DayOfYear, i16),
171    (Hour, i8),
172    (Hour12, i8, "hour (12 hour clock)", 1, 12),
173    (ISOWeek, i8),
174    (ISOYear, i16),
175    // This matches Temporal's range.
176    // See: https://github.com/tc39/proposal-temporal/issues/2458#issuecomment-1380742911
177    (Increment, i64, "rounding increment", 1, 1_000_000_000),
178    (Increment32, i32, "rounding increment", 1, 1_000_000_000),
179    // This is only used in parsing. A value of `60` gets clamped to `59`.
180    (LeapSecond, i8, "second", 0, 60),
181    (Microsecond, i16),
182    (Millisecond, i16),
183    (Minute, i8),
184    (Month, i8),
185    (Nanosecond, i16),
186    (NthWeekday, i32),
187    (OffsetHours, i8),
188    (OffsetMinutes, i8),
189    (OffsetSeconds, i8),
190    (OffsetTotalSeconds, i32),
191    (Second, i8),
192    (SignedDurationSeconds, i64, "signed duration seconds", i64::MIN, i64::MAX),
193    (SpanYears, i16, "years", -Self::MAX, (Year::LEN - 1) as i16),
194    (SpanMonths, i32, "months", -Self::MAX, SpanYears::MAX as i32 * 12),
195    (SpanWeeks, i32, "weeks", -Self::MAX, SpanDays::MAX / c::DAYS_PER_CIVIL_WEEK_32),
196    (SpanDays, i32, "days", -Self::MAX, SpanHours::MAX / c::HOURS_PER_CIVIL_DAY_32),
197    (SpanHours, i32, "hours", -Self::MAX, (SpanMinutes::MAX / c::MINS_PER_HOUR) as i32),
198    (SpanMinutes, i64, "minutes", -Self::MAX, SpanSeconds::MAX / c::SECS_PER_MIN),
199    (
200        SpanSeconds,
201        i64,
202        "seconds",
203        bounds::DeltaSeconds::MIN,
204        bounds::DeltaSeconds::MAX,
205    ),
206    (
207        SpanMilliseconds,
208        i64,
209        "milliseconds",
210        -Self::MAX,
211        SpanSeconds::MAX * c::MILLIS_PER_SEC,
212    ),
213    (
214        SpanMicroseconds,
215        i64,
216        "microseconds",
217        -Self::MAX,
218        SpanMilliseconds::MAX * c::MICROS_PER_MILLI,
219    ),
220    (SpanMultiple, i64, "span multiple", i64::MIN  + 1, i64::MAX),
221    // A range of the allowed number of nanoseconds.
222    //
223    // For this, we cannot cover the full span of supported time instants since
224    // `UnixSeconds::MAX * NANOSECONDS_PER_SECOND` cannot fit into 64-bits. We
225    // could use a `i128`, but it doesn't seem worth bloating up `Span`.
226    //
227    // Also note that our min is equal to -max, so that the total number of
228    // values in this range is one less than the number of distinct `i64`
229    // values. We do that so that the absolute value is always defined.
230    (SpanNanoseconds, i64, "nanoseconds", i64::MIN + 1, i64::MAX),
231    (SubsecNanosecond, i32),
232    (SignedSubsecNanosecond, i32),
233    (UnixEpochDays, i32),
234    (UnixEpochMilliseconds, i64),
235    (UnixEpochMicroseconds, i64),
236    (UnixEpochSeconds, i64),
237    (WeekNum, i8, "week-number", 0, 53),
238    (WeekdayMondayZero, i8),
239    (WeekdayMondayOne, i8),
240    (WeekdaySundayZero, i8),
241    (WeekdaySundayOne, i8),
242    // The range of years supported by Jiff.
243    //
244    // This is ultimately where some of the other ranges (like `UnixSeconds`)
245    // were determined from. That is, the range of years is the primary point
246    // at which the space of supported time instants is derived from. If one
247    // wanted to expand this range, you'd need to change it here and then
248    // compute the corresponding min/max values for `UnixSeconds`. (Among other
249    // things... Increasing the supported Jiff range is far more complicated
250    // than just changing some ranges here.)
251    (Year, i16),
252    (YearCE, i16),
253    (YearBCE, i16),
254    (YearTwoDigit, i16, "year (2 digits)", 0, 99),
255    (
256        ZonedDateTimeDayNanoseconds,
257        i64,
258        "nanoseconds (in one zoned datetime day)",
259        ZonedDateTimeDaySeconds::MIN as i64 * c::NANOS_PER_SEC,
260        ZonedDateTimeDaySeconds::MAX as i64 * c::NANOS_PER_SEC,
261    ),
262    // The number of seconds permitted in a single day.
263    //
264    // This is mostly just a "sensible" cap on what is possible. We allow one
265    // day to span up to 7 civil days.
266    //
267    // It must also be at least 1 second long.
268    (
269        ZonedDateTimeDaySeconds,
270        i32,
271        "seconds (in one zoned datetime day)",
272        1,
273        7 * c::SECS_PER_CIVIL_DAY_32,
274    ),
275}
276
277impl From<BoundsError> for Error {
278    fn from(err: BoundsError) -> Error {
279        Error::bounds(err)
280    }
281}
282
283impl crate::error::IntoError for BoundsError {
284    fn into_error(self) -> Error {
285        self.into()
286    }
287}
288
289/// Like `BoundsError`, but maintained manually.
290///
291/// This is useful for range errors outside of the framework above.
292#[derive(#[automatically_derived]impl ::core::clone::Clone for SpecialBoundsError {
    #[inline]
    #[rustc_trivial_field_reads]
    fn clone(&self) -> Self {
        match self {
            Self::SignedDurationFloatOutOfRangeF32 =>
                SpecialBoundsError::SignedDurationFloatOutOfRangeF32,
            Self::SignedDurationFloatOutOfRangeF64 =>
                SpecialBoundsError::SignedDurationFloatOutOfRangeF64,
            Self::SignedToUnsignedDuration =>
                SpecialBoundsError::SignedToUnsignedDuration,
        }
    }
}Clone, #[automatically_derived]impl ::core::fmt::Debug for SpecialBoundsError {
    #[inline]
    #[rustc_trivial_field_reads]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                SpecialBoundsError::SignedDurationFloatOutOfRangeF32 =>
                    "SignedDurationFloatOutOfRangeF32",
                SpecialBoundsError::SignedDurationFloatOutOfRangeF64 =>
                    "SignedDurationFloatOutOfRangeF64",
                SpecialBoundsError::SignedToUnsignedDuration =>
                    "SignedToUnsignedDuration",
            })
    }
}Debug)]
293#[cfg_attr(feature = "defmt", derive(defmt::Format))]
294pub(crate) enum SpecialBoundsError {
295    SignedDurationFloatOutOfRangeF32,
296    SignedDurationFloatOutOfRangeF64,
297    SignedToUnsignedDuration,
298}
299
300impl core::fmt::Display for SpecialBoundsError {
301    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
302        use self::SpecialBoundsError::*;
303
304        match *self {
305            SignedToUnsignedDuration => f.write_str(
306                "negative signed durations cannot be converted \
307                 to an unsigned duration",
308            ),
309            SignedDurationFloatOutOfRangeF32 => {
310                f.write_fmt(format_args!("parameter \'floating point seconds\' is not in the required range of {0}..={1}",
        i64::MIN as f32, i64::MAX as f32))write!(
311                    f,
312                    "parameter 'floating point seconds' is not in \
313                     the required range of {min}..={max}",
314                    min = i64::MIN as f32,
315                    max = i64::MAX as f32,
316                )
317            }
318            SignedDurationFloatOutOfRangeF64 => {
319                f.write_fmt(format_args!("parameter \'floating point seconds\' is not in the required range of {0}..={1}",
        i64::MIN as f64, i64::MAX as f64))write!(
320                    f,
321                    "parameter 'floating point seconds' is not in \
322                     the required range of {min}..={max}",
323                    min = i64::MIN as f64,
324                    max = i64::MAX as f64,
325                )
326            }
327        }
328    }
329}
330
331impl From<SpecialBoundsError> for Error {
332    fn from(err: SpecialBoundsError) -> Error {
333        Error::special_bounds(err)
334    }
335}
336
337impl crate::error::IntoError for SpecialBoundsError {
338    fn into_error(self) -> Error {
339        self.into()
340    }
341}
342
343#[cfg(test)]
344mod tests {
345    use alloc::string::ToString;
346
347    use super::*;
348
349    #[test]
350    fn size_of_bounds_error() {
351        // It's okay if this grows, but I wrote this test initially
352        // to confirm that a `BoundsError` is very small. (Since it's
353        // just a bunch of variants of ZSTs.)
354        assert_eq!(1, core::mem::size_of::<BoundsError>());
355    }
356
357    #[test]
358    fn basic_error_functionality() {
359        let err = Year::check(10_000).unwrap_err();
360        assert_eq!(
361            err.to_string(),
362            "parameter 'year' is not in the required range of -9999..=9999",
363        );
364    }
365}