99 lines
14 KiB
HTML
99 lines
14 KiB
HTML
<!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" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><script defer src="../main.js"></script>
|
||
<noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut 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="sidebar"><div class="sidebar-menu" role="button">☰</div><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">Crate time</h2><div class="block version"><div class="narrow-helper"></div><p>Version 0.3.7</p></div><div class="sidebar-elems"><a id="all-types" href="all.html"><p>See all time's items</p></a><div class="block items"><ul><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></div><div id="sidebar-vars" data-name="time" data-ty="mod" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../time/index.html"><img src="https://avatars0.githubusercontent.com/u/55999857" alt="logo"></a><nav class="sub"><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav></div><section id="main-content" class="content"><h1 class="fqn"><span class="in-band">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></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../src/time/lib.rs.html#1-330" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="feature-flags" class="section-header"><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>
|
||
<p>If you are using this feature, <strong>please leave a comment</strong>
|
||
<a href="https://github.com/time-rs/time/discussions/306">on this discussion</a> with your use case. If
|
||
there is not sufficient demand for this feature, it will be dropped in a future release.</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/alloc</code>, <code>formatting</code>, and <code>parsing</code></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>
|
||
</ul>
|
||
<p>One pseudo-feature flag that is only available to end users is the <code>unsound_local_offset</code> cfg.
|
||
As the name indicates, using the feature is unsound, and <a href="https://github.com/time-rs/time/issues/293">may cause unexpected segmentation
|
||
faults</a>. Unlike other flags, this is deliberately
|
||
only available to end users; this is to ensure that a user doesn’t have unsound behavior without
|
||
knowing it. To enable this behavior, you must use <code>RUSTFLAGS="--cfg unsound_local_offset" cargo build</code> or similar. Note: This flag is <em>not tested anywhere</em>, including in the regular test of
|
||
the powerset of all feature flags. Use at your own risk. Without this flag, any method that
|
||
requires the local offset will return the <code>Err</code> variant.</p>
|
||
</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"><code>pub use crate::error::<a class="enum" href="error/enum.Error.html" title="enum time::error::Error">Error</a>;</code></div><div class="item-right docblock-short"></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"><p>Various error types returned by methods in the time crate.</p>
|
||
</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"><p>Extension traits.</p>
|
||
</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"><p>Description of how types should be formatted and parsed.</p>
|
||
</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"><p>Formatting for various types.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="macros/index.html" title="time::macros mod">macros</a></div><div class="item-right docblock-short"><p>Macros to construct statically known values.</p>
|
||
</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"><p>Utility functions.</p>
|
||
</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"><p>Date in the proleptic Gregorian calendar.</p>
|
||
</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"><p>A span of time with nanosecond precision.</p>
|
||
</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"><p>A measurement of a monotonically non-decreasing clock. Opaque and useful only with <a href="struct.Duration.html" title="Duration"><code>Duration</code></a>.</p>
|
||
</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"><p>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>.</p>
|
||
</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"><p>Combined date and time.</p>
|
||
</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"><p>The clock time within a given date. Nanosecond precision.</p>
|
||
</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"><p>An offset from UTC.</p>
|
||
</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"><p>Months of the year.</p>
|
||
</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"><p>Days of the week.</p>
|
||
</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"><p>An alias for <a href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="std::result::Result"><code>std::result::Result</code></a> with a generic error from the time crate.</p>
|
||
</div></div></div></section><section id="search" class="content hidden"></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.59.0 (9d1b2106e 2022-02-23)" ></div>
|
||
</body></html> |