Name Description Size Coverage
date.rs The [`Date`] struct and its associated `impl`s. 54277 -
duration.rs The [`Duration`] struct and its associated `impl`s. 63900 -
error -
ext -
format_description -
formatting -
hint.rs Hints to the compiler that affects how code should be emitted or optimized. 569 -
instant.rs The [`Instant`] struct and its associated `impl`s. 10956 -
internal_macros.rs Macros for use within the library. They are not publicly available. 7744 -
interop -
lib.rs # Feature flags This crate exposes a number of features. These can be enabled or disabled as shown [in Cargo's documentation](https://doc.rust-lang.org/cargo/reference/features.html). Features are _disabled_ by default unless otherwise noted. Reliance on a given feature is always indicated alongside the item definition. - `std` (_enabled by default, implicitly enables `alloc`_) This enables a number of features that depend on the standard library. - `alloc` (_enabled by default via `std`_) Enables a number of features that require the ability to dynamically allocate memory. - `macros` Enables macros that provide compile-time verification of values and intuitive syntax. - `formatting` (_implicitly enables `std`_) Enables formatting of most structs. - `parsing` Enables parsing of most structs. - `local-offset` (_implicitly enables `std`_) This feature enables a number of methods that allow obtaining the system's UTC offset. - `large-dates` By default, only years within the ±9999 range (inclusive) are supported. If you need support for years outside this range, consider enabling this feature; the supported range will be increased to ±999,999. Note that enabling this feature has some costs, as it means forgoing some optimizations. Ambiguities may be introduced when parsing that would not otherwise exist. - `serde` Enables [`serde`](https://docs.rs/serde) support for all types. - `serde-human-readable` (_implicitly enables `serde`, `formatting`, and `parsing`_) Allows `serde` representations to use a human-readable format. This is determined by the serializer, not the user. If this feature is not enabled or if the serializer requests a non-human-readable format, a format optimized for binary representation will be used. Libraries should never enable this feature, as the decision of what format to use should be up to the user. - `rand` (_implicitly enables `rand08` and `rand09`_) Previously, this would enable support for `rand` 0.8. Since the release of `rand` 0.9, the feature has been split into `rand08` and `rand09` to allow support for both versions. For backwards compatibility and simplicity, this feature enables support for _both_ series. It is strongly recommended to enable `rand08` or `rand09` directly, as enabling `rand` will needlessly pull in both versions. - `rand08` Enables [`rand` 0.8](https://docs.rs/rand/0.8) support for all types. - `rand09` Enables [`rand` 0.9](https://docs.rs/rand/0.9) support for all types. - `quickcheck` (_implicitly enables `alloc`_) Enables [quickcheck](https://docs.rs/quickcheck) support for all types. - `wasm-bindgen` Enables [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) support for converting [JavaScript dates](https://rustwasm.github.io/wasm-bindgen/api/js_sys/struct.Date.html), as well as obtaining the UTC offset from JavaScript. 4966 -
macros.rs Macros to construct statically known values. 6224 -
month.rs The `Month` enum and its associated `impl`s. 7370 -
offset_date_time.rs The [`OffsetDateTime`] struct and its associated `impl`s. 57586 -
parsing -
primitive_date_time.rs The [`PrimitiveDateTime`] struct and its associated `impl`s. 39849 -
quickcheck.rs Implementations of the [`quickcheck::Arbitrary`](quickcheck::Arbitrary) trait. This enables users to write tests such as this, and have test values provided automatically: ```ignore # #![expect(dead_code)] use quickcheck::quickcheck; use time::Date; struct DateRange { from: Date, to: Date, } impl DateRange { fn new(from: Date, to: Date) -> Result<Self, ()> { Ok(DateRange { from, to }) } } quickcheck! { fn date_range_is_well_defined(from: Date, to: Date) -> bool { let r = DateRange::new(from, to); if from <= to { r.is_ok() } else { r.is_err() } } } ``` An implementation for `Instant` is intentionally omitted since its values are only meaningful in relation to a [`Duration`], and obtaining an `Instant` from a [`Duration`] is very simple anyway. 6567 -
rand08.rs Implementation of [`Distribution`] for various structs. 3130 -
rand09.rs Implementation of [`Distribution`] for various structs. 3210 -
serde -
sys -
tests.rs Tests for internal details. This module should only be used when it is not possible to test the implementation in a reasonable manner externally. 3303 -
time.rs The [`Time`] struct and its associated `impl`s. 39650 -
utc_date_time.rs The [`UtcDateTime`] struct and associated `impl`s. 46059 -
utc_offset.rs The [`UtcOffset`] struct and its associated `impl`s. 19066 -
util.rs Utility functions, including updating time zone information. 3886 -
weekday.rs Days of the week. 6211 -