Skip to main content

Module bounds

Module bounds 

Source
Expand description

Defines boundary types and their corresponding error values.

The main trait in this module is Bounds. It is implemented by each of several boundary types describing a range of contiguous values used by Jiff. For example, Year corresponds to the range of support calendar year values.

Each range type has concrete methods defined on it that simply forward to its corresponding method on Bounds. For example, Year::check forwards to the default implementation of Bounds::check. These concrete wrappers exist to make calling the routines more ergonomic. For example, they don’t require that the Bounds trait be in scope. Additionally, a Year::checkc concrete method is provide for use in const contexts. This is not available on the Bounds trait because generics are not yet supported (as of 2026-02-13) in a const context.

Modules§

const_check
Provides routines usable in a const context for checking boundary values.
const_checked_add
Provides routines usable in a const context for checked arithmetic.

Structs§

BoundsError
The error type used by the trait implementations of Bounds in this crate.
CivilDayNanosecond
The supported range of nanoseconds in a single civil day.
CivilDaySecond
The supported range of seconds in a single civil day.
Day
The supported range of “day of month.”
DayOfYear
The supported range of “day of year.”
DayOfYearNoLeap
The supported range of “day of year,” but never including Feb 29.
DeltaSeconds
The range of seconds for the possible differences between any two pairs of (timestamp, offset).
Hour
The range of hours supported.
ISOWeek
The supported range of week numbers in the ISO 8601 week calendar.
ISOYear
The supported range of year numbers in the ISO 8601 week calendar.
Microsecond
The supported range of microsecond values.
Millisecond
The supported range of millisecond values.
Minute
The supported range of minute values.
Month
The supported range of month values.
Nanosecond
The supported range of nanosecond values.
NthWeekday
The supported range of values for getting the “nth weekday” from a date.
NthWeekdayOfMonth
The supported range of values for getting the “nth weekday of a month” from a particular date.
OffsetHours
The number of hours allowed in a time zone offset.
OffsetMinutes
The supported range of “minute” component of a time zone offset.
OffsetSeconds
The supported range of “second” component of a time zone offset.
OffsetTotalSeconds
The supported range of time zone offsets, expressed in units of seconds.
RangeError
An error type that combines BoundsError with other custom error variants.
RawBoundsError
An error type that encodes information from an implementation of Bounds.
Second
The supported range of second values.
SignedSubsecNanosecond
The supported range of a timestamp’s subsecond component.
SubsecNanosecond
The supported range of fractional seconds, expressed in units of nanoseconds.
TimestampArithmeticNanosecond
An error that occurs when doing arithmetic on a timestamp overflows the i32 representation of a nanosecond.
UnixEpochDays
The supported range of days from the Unix epoch for the Gregorian calendar.
UnixEpochMicroseconds
UnixEpochMilliseconds
UnixEpochSeconds
The supported range of seconds for the difference between any two values of UnixEpochDays.
WeekdayMondayOne
The supported range of 1-offset week day values when weeks start on Monday.
WeekdayMondayZero
The supported range of 0-offset week day values when weeks start on Monday.
WeekdaySundayOne
The supported range of 1-offset week day values when weeks start on Sunday.
WeekdaySundayZero
The supported range of 0-offset week day values when weeks start on Sunday.
Year
The range of years supported.
YearBCE
The range of years supported for Before Common Era (BCE).
YearCE
The range of years supported for the Common Era (CE).

Enums§

Sign
A representation of a numeric sign.

Traits§

Bounds
An interface for defining boundaries on integer values.
Primitive
A trait for making x as int_type usable in a generic context.