blob: 92253e95b5f8d7bf75b91f2e556980403f9ad80b [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Feature flags"><meta name="keywords" content="rust, rustlang, rust-lang, time"><title>time - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="../crates.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" href="https://avatars0.githubusercontent.com/u/55999857"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../time/index.html"><div class="logo-container"><img src="https://avatars0.githubusercontent.com/u/55999857" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../time/index.html"><div class="logo-container">
<img src="https://avatars0.githubusercontent.com/u/55999857" alt="logo"></div></a><h2 class="location"><a href="#">Crate time</a></h2><div class="sidebar-elems"><ul class="block"><li class="version">Version 0.3.21</li><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#reexports">Re-exports</a></li><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Crate <a class="mod" href="#">time</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/time/lib.rs.html#1-373">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="feature-flags"><a href="#feature-flags">Feature flags</a></h2>
<p>This crate exposes a number of features. These can be enabled or disabled as shown
<a href="https://doc.rust-lang.org/cargo/reference/features.html">in Cargo’s documentation</a>. Features
are <em>disabled</em> by default unless otherwise noted.</p>
<p>Reliance on a given feature is always indicated alongside the item definition.</p>
<ul>
<li>
<p><code>std</code> (<em>enabled by default, implicitly enables <code>alloc</code></em>)</p>
<p>This enables a number of features that depend on the standard library.</p>
</li>
<li>
<p><code>alloc</code> (<em>enabled by default via <code>std</code></em>)</p>
<p>Enables a number of features that require the ability to dynamically allocate memory.</p>
</li>
<li>
<p><code>macros</code></p>
<p>Enables macros that provide compile-time verification of values and intuitive syntax.</p>
</li>
<li>
<p><code>formatting</code> (<em>implicitly enables <code>std</code></em>)</p>
<p>Enables formatting of most structs.</p>
</li>
<li>
<p><code>parsing</code></p>
<p>Enables parsing of most structs.</p>
</li>
<li>
<p><code>local-offset</code> (<em>implicitly enables <code>std</code></em>)</p>
<p>This feature enables a number of methods that allow obtaining the system’s UTC offset.</p>
</li>
<li>
<p><code>large-dates</code></p>
<p>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.</p>
<p>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.</p>
</li>
<li>
<p><code>serde</code></p>
<p>Enables <a href="https://docs.rs/serde">serde</a> support for all types except <a href="struct.Instant.html" title="Instant"><code>Instant</code></a>.</p>
</li>
<li>
<p><code>serde-human-readable</code> (<em>implicitly enables <code>serde</code>, <code>formatting</code>, and <code>parsing</code></em>)</p>
<p>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.</p>
<p>Libraries should never enable this feature, as the decision of what format to use should be up
to the user.</p>
</li>
<li>
<p><code>serde-well-known</code> (<em>implicitly enables <code>serde-human-readable</code></em>)</p>
<p><em>This feature flag is deprecated and will be removed in a future breaking release. Use the
<code>serde-human-readable</code> feature instead.</em></p>
<p>Enables support for serializing and deserializing well-known formats using serde’s
<a href="https://serde.rs/field-attrs.html#with"><code>#[with]</code> attribute</a>.</p>
</li>
<li>
<p><code>rand</code></p>
<p>Enables <a href="https://docs.rs/rand">rand</a> support for all types.</p>
</li>
<li>
<p><code>quickcheck</code> (<em>implicitly enables <code>alloc</code></em>)</p>
<p>Enables <a href="https://docs.rs/quickcheck">quickcheck</a> support for all types except <a href="struct.Instant.html" title="Instant"><code>Instant</code></a>.</p>
</li>
<li>
<p><code>wasm-bindgen</code></p>
<p>Enables <a href="https://github.com/rustwasm/wasm-bindgen">wasm-bindgen</a> support for converting
<a href="https://rustwasm.github.io/wasm-bindgen/api/js_sys/struct.Date.html">JavaScript dates</a>, as
well as obtaining the UTC offset from JavaScript.</p>
</li>
</ul>
</div></details><h2 id="reexports" class="small-section-header"><a href="#reexports">Re-exports</a></h2><div class="item-table"><div class="item-row"><div class="item-left import-item" id="reexport.Error"><code>pub use crate::error::<a class="enum" href="error/enum.Error.html" title="enum time::error::Error">Error</a>;</code></div></div></div><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="error/index.html" title="time::error mod">error</a></div><div class="item-right docblock-short">Various error types returned by methods in the time crate.</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="ext/index.html" title="time::ext mod">ext</a></div><div class="item-right docblock-short">Extension traits.</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="format_description/index.html" title="time::format_description mod">format_description</a></div><div class="item-right docblock-short">Description of how types should be formatted and parsed.</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="formatting/index.html" title="time::formatting mod">formatting</a></div><div class="item-right docblock-short">Formatting for various types.</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="parsing/index.html" title="time::parsing mod">parsing</a></div><div class="item-right docblock-short">Parsing for various types.</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="serde/index.html" title="time::serde mod">serde</a></div><div class="item-right docblock-short">Differential formats for serde.</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="util/index.html" title="time::util mod">util</a></div><div class="item-right docblock-short">Utility functions.</div></div></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Date.html" title="time::Date struct">Date</a></div><div class="item-right docblock-short">Date in the proleptic Gregorian calendar.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Duration.html" title="time::Duration struct">Duration</a></div><div class="item-right docblock-short">A span of time with nanosecond precision.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Instant.html" title="time::Instant struct">Instant</a></div><div class="item-right docblock-short">A measurement of a monotonically non-decreasing clock. Opaque and useful only with <a href="struct.Duration.html" title="Duration"><code>Duration</code></a>.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.OffsetDateTime.html" title="time::OffsetDateTime struct">OffsetDateTime</a></div><div class="item-right docblock-short">A <a href="struct.PrimitiveDateTime.html" title="PrimitiveDateTime"><code>PrimitiveDateTime</code></a> with a <a href="struct.UtcOffset.html" title="UtcOffset"><code>UtcOffset</code></a>.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.PrimitiveDateTime.html" title="time::PrimitiveDateTime struct">PrimitiveDateTime</a></div><div class="item-right docblock-short">Combined date and time.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Time.html" title="time::Time struct">Time</a></div><div class="item-right docblock-short">The clock time within a given date. Nanosecond precision.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.UtcOffset.html" title="time::UtcOffset struct">UtcOffset</a></div><div class="item-right docblock-short">An offset from UTC.</div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Month.html" title="time::Month enum">Month</a></div><div class="item-right docblock-short">Months of the year.</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Weekday.html" title="time::Weekday enum">Weekday</a></div><div class="item-right docblock-short">Days of the week.</div></div></div><h2 id="types" class="small-section-header"><a href="#types">Type Definitions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="type" href="type.Result.html" title="time::Result type">Result</a></div><div class="item-right docblock-short">An alias for [<code>std::result::Result</code>] with a generic error from the time crate.</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="time" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>