| <!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="An offset from UTC."><meta name="keywords" content="rust, rustlang, rust-lang, UtcOffset"><title>UtcOffset in 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="sidebar-items.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 struct"><!--[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">☰</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="#">UtcOffset</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Associated Constants</a></h3><ul class="block"><li><a href="#associatedconstant.UTC">UTC</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.as_hms">as_hms</a></li><li><a href="#method.format">format</a></li><li><a href="#method.format_into">format_into</a></li><li><a href="#method.from_hms">from_hms</a></li><li><a href="#method.from_whole_seconds">from_whole_seconds</a></li><li><a href="#method.is_negative">is_negative</a></li><li><a href="#method.is_positive">is_positive</a></li><li><a href="#method.is_utc">is_utc</a></li><li><a href="#method.minutes_past_hour">minutes_past_hour</a></li><li><a href="#method.parse">parse</a></li><li><a href="#method.seconds_past_minute">seconds_past_minute</a></li><li><a href="#method.whole_hours">whole_hours</a></li><li><a href="#method.whole_minutes">whole_minutes</a></li><li><a href="#method.whole_seconds">whole_seconds</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Clone-for-UtcOffset">Clone</a></li><li><a href="#impl-Copy-for-UtcOffset">Copy</a></li><li><a href="#impl-Debug-for-UtcOffset">Debug</a></li><li><a href="#impl-Deserialize%3C%27a%3E-for-UtcOffset">Deserialize<'a></a></li><li><a href="#impl-Display-for-UtcOffset">Display</a></li><li><a href="#impl-Eq-for-UtcOffset">Eq</a></li><li><a href="#impl-Hash-for-UtcOffset">Hash</a></li><li><a href="#impl-Neg-for-UtcOffset">Neg</a></li><li><a href="#impl-Ord-for-UtcOffset">Ord</a></li><li><a href="#impl-PartialEq%3CUtcOffset%3E-for-UtcOffset">PartialEq<UtcOffset></a></li><li><a href="#impl-PartialOrd%3CUtcOffset%3E-for-UtcOffset">PartialOrd<UtcOffset></a></li><li><a href="#impl-Serialize-for-UtcOffset">Serialize</a></li><li><a href="#impl-StructuralEq-for-UtcOffset">StructuralEq</a></li><li><a href="#impl-StructuralPartialEq-for-UtcOffset">StructuralPartialEq</a></li><li><a href="#impl-TryFrom%3CParsed%3E-for-UtcOffset">TryFrom<Parsed></a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-UtcOffset">RefUnwindSafe</a></li><li><a href="#impl-Send-for-UtcOffset">Send</a></li><li><a href="#impl-Sync-for-UtcOffset">Sync</a></li><li><a href="#impl-Unpin-for-UtcOffset">Unpin</a></li><li><a href="#impl-UnwindSafe-for-UtcOffset">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-UtcOffset">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-UtcOffset">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-UtcOffset">BorrowMut<T></a></li><li><a href="#impl-DeserializeOwned-for-UtcOffset">DeserializeOwned</a></li><li><a href="#impl-From%3CT%3E-for-UtcOffset">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-UtcOffset">Into<U></a></li><li><a href="#impl-ToOwned-for-UtcOffset">ToOwned</a></li><li><a href="#impl-ToString-for-UtcOffset">ToString</a></li><li><a href="#impl-TryFrom%3CU%3E-for-UtcOffset">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-UtcOffset">TryInto<U></a></li></ul></section><h2><a href="index.html">In time</a></h2></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">Struct <a href="index.html">time</a>::<wbr><a class="struct" href="#">UtcOffset</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/utc_offset.rs.html#25-32">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct UtcOffset { /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An offset from UTC.</p> |
| <p>This struct can store values up to ±23:59:59. If you need support outside this range, please |
| file an issue with your use case.</p> |
| </div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><div id="implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#34-281">source</a><a href="#impl-UtcOffset" class="anchor"></a><h3 class="code-header">impl <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedconstant.UTC" class="associatedconstant has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#42">source</a><h4 class="code-header">pub const <a href="#associatedconstant.UTC" class="constant">UTC</a>: Self = _</h4></section></summary><div class="docblock"><p>A <code>UtcOffset</code> that is UTC.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(UtcOffset::UTC, <span class="macro">offset!</span>(UTC));</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%0Ause%20time%3A%3AUtcOffset%3B%0Ause%20time_macros%3A%3Aoffset%3B%0Aassert_eq!(UtcOffset%3A%3AUTC%2C%20offset!(UTC))%3B%0A%7D&edition=2021">Run</a></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_hms" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#85-110">source</a><h4 class="code-header">pub const fn <a href="#method.from_hms" class="fnname">from_hms</a>(<br> hours: i8,<br> minutes: i8,<br> seconds: i8<br>) -> Result<Self, <a class="struct" href="error/struct.ComponentRange.html" title="struct time::error::ComponentRange">ComponentRange</a>></h4></section></summary><div class="docblock"><p>Create a <code>UtcOffset</code> representing an offset by the number of hours, minutes, and seconds |
| provided.</p> |
| <p>The sign of all three components should match. If they do not, all smaller components will |
| have their signs flipped.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(UtcOffset::from_hms(<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>)<span class="question-mark">?</span>.as_hms(), (<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>)); |
| <span class="macro">assert_eq!</span>(UtcOffset::from_hms(<span class="number">1</span>, -<span class="number">2</span>, -<span class="number">3</span>)<span class="question-mark">?</span>.as_hms(), (<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>));</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%20fn%20_inner()%20-%3E%20Result%3C()%2C%20impl%20core%3A%3Afmt%3A%3ADebug%3E%20%7B%0Ause%20time%3A%3AUtcOffset%3B%0Aassert_eq!(UtcOffset%3A%3Afrom_hms(1%2C%202%2C%203)%3F.as_hms()%2C%20(1%2C%202%2C%203))%3B%0Aassert_eq!(UtcOffset%3A%3Afrom_hms(1%2C%20-2%2C%20-3)%3F.as_hms()%2C%20(1%2C%202%2C%203))%3B%0AOk%3A%3A%3C_%2C%20time%3A%3AError%3E(())%0A%7D%20_inner().unwrap()%20%7D&edition=2021">Run</a></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_whole_seconds" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#119-129">source</a><h4 class="code-header">pub const fn <a href="#method.from_whole_seconds" class="fnname">from_whole_seconds</a>(seconds: i32) -> Result<Self, <a class="struct" href="error/struct.ComponentRange.html" title="struct time::error::ComponentRange">ComponentRange</a>></h4></section></summary><div class="docblock"><p>Create a <code>UtcOffset</code> representing an offset by the number of seconds provided.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(UtcOffset::from_whole_seconds(<span class="number">3_723</span>)<span class="question-mark">?</span>.as_hms(), (<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>));</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%20fn%20_inner()%20-%3E%20Result%3C()%2C%20impl%20core%3A%3Afmt%3A%3ADebug%3E%20%7B%0Ause%20time%3A%3AUtcOffset%3B%0Aassert_eq!(UtcOffset%3A%3Afrom_whole_seconds(3_723)%3F.as_hms()%2C%20(1%2C%202%2C%203))%3B%0AOk%3A%3A%3C_%2C%20time%3A%3AError%3E(())%0A%7D%20_inner().unwrap()%20%7D&edition=2021">Run</a></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_hms" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#141-143">source</a><h4 class="code-header">pub const fn <a href="#method.as_hms" class="fnname">as_hms</a>(self) -> (i8, i8, i8)</h4></section></summary><div class="docblock"><p>Obtain the UTC offset as its hours, minutes, and seconds. The sign of all three components |
| will always match. A positive value indicates an offset to the east; a negative to the west.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(+<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).as_hms(), (<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>)); |
| <span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(-<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).as_hms(), (-<span class="number">1</span>, -<span class="number">2</span>, -<span class="number">3</span>));</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%0Ause%20time_macros%3A%3Aoffset%3B%0Aassert_eq!(offset!(%2B1%3A02%3A03).as_hms()%2C%20(1%2C%202%2C%203))%3B%0Aassert_eq!(offset!(-1%3A02%3A03).as_hms()%2C%20(-1%2C%20-2%2C%20-3))%3B%0A%7D&edition=2021">Run</a></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.whole_hours" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#153-155">source</a><h4 class="code-header">pub const fn <a href="#method.whole_hours" class="fnname">whole_hours</a>(self) -> i8</h4></section></summary><div class="docblock"><p>Obtain the number of whole hours the offset is from UTC. A positive value indicates an |
| offset to the east; a negative to the west.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(+<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).whole_hours(), <span class="number">1</span>); |
| <span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(-<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).whole_hours(), -<span class="number">1</span>);</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%0Ause%20time_macros%3A%3Aoffset%3B%0Aassert_eq!(offset!(%2B1%3A02%3A03).whole_hours()%2C%201)%3B%0Aassert_eq!(offset!(-1%3A02%3A03).whole_hours()%2C%20-1)%3B%0A%7D&edition=2021">Run</a></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.whole_minutes" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#165-167">source</a><h4 class="code-header">pub const fn <a href="#method.whole_minutes" class="fnname">whole_minutes</a>(self) -> i16</h4></section></summary><div class="docblock"><p>Obtain the number of whole minutes the offset is from UTC. A positive value indicates an |
| offset to the east; a negative to the west.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(+<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).whole_minutes(), <span class="number">62</span>); |
| <span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(-<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).whole_minutes(), -<span class="number">62</span>);</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%0Ause%20time_macros%3A%3Aoffset%3B%0Aassert_eq!(offset!(%2B1%3A02%3A03).whole_minutes()%2C%2062)%3B%0Aassert_eq!(offset!(-1%3A02%3A03).whole_minutes()%2C%20-62)%3B%0A%7D&edition=2021">Run</a></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.minutes_past_hour" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#177-179">source</a><h4 class="code-header">pub const fn <a href="#method.minutes_past_hour" class="fnname">minutes_past_hour</a>(self) -> i8</h4></section></summary><div class="docblock"><p>Obtain the number of minutes past the hour the offset is from UTC. A positive value |
| indicates an offset to the east; a negative to the west.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(+<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).minutes_past_hour(), <span class="number">2</span>); |
| <span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(-<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).minutes_past_hour(), -<span class="number">2</span>);</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%0Ause%20time_macros%3A%3Aoffset%3B%0Aassert_eq!(offset!(%2B1%3A02%3A03).minutes_past_hour()%2C%202)%3B%0Aassert_eq!(offset!(-1%3A02%3A03).minutes_past_hour()%2C%20-2)%3B%0A%7D&edition=2021">Run</a></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.whole_seconds" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#191-195">source</a><h4 class="code-header">pub const fn <a href="#method.whole_seconds" class="fnname">whole_seconds</a>(self) -> i32</h4></section></summary><div class="docblock"><p>Obtain the number of whole seconds the offset is from UTC. A positive value indicates an |
| offset to the east; a negative to the west.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(+<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).whole_seconds(), <span class="number">3723</span>); |
| <span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(-<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).whole_seconds(), -<span class="number">3723</span>);</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%0Ause%20time_macros%3A%3Aoffset%3B%0Aassert_eq!(offset!(%2B1%3A02%3A03).whole_seconds()%2C%203723)%3B%0Aassert_eq!(offset!(-1%3A02%3A03).whole_seconds()%2C%20-3723)%3B%0A%7D&edition=2021">Run</a></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.seconds_past_minute" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#205-207">source</a><h4 class="code-header">pub const fn <a href="#method.seconds_past_minute" class="fnname">seconds_past_minute</a>(self) -> i8</h4></section></summary><div class="docblock"><p>Obtain the number of seconds past the minute the offset is from UTC. A positive value |
| indicates an offset to the east; a negative to the west.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(+<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).seconds_past_minute(), <span class="number">3</span>); |
| <span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(-<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).seconds_past_minute(), -<span class="number">3</span>);</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%0Ause%20time_macros%3A%3Aoffset%3B%0Aassert_eq!(offset!(%2B1%3A02%3A03).seconds_past_minute()%2C%203)%3B%0Aassert_eq!(offset!(-1%3A02%3A03).seconds_past_minute()%2C%20-3)%3B%0A%7D&edition=2021">Run</a></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_utc" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#220-222">source</a><h4 class="code-header">pub const fn <a href="#method.is_utc" class="fnname">is_utc</a>(self) -> bool</h4></section></summary><div class="docblock"><p>Check if the offset is exactly UTC.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert!</span>(!<span class="macro">offset!</span>(+<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).is_utc()); |
| <span class="macro">assert!</span>(!<span class="macro">offset!</span>(-<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).is_utc()); |
| <span class="macro">assert!</span>(<span class="macro">offset!</span>(UTC).is_utc());</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%0Ause%20time_macros%3A%3Aoffset%3B%0Aassert!(!offset!(%2B1%3A02%3A03).is_utc())%3B%0Aassert!(!offset!(-1%3A02%3A03).is_utc())%3B%0Aassert!(offset!(UTC).is_utc())%3B%0A%7D&edition=2021">Run</a></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_positive" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#232-234">source</a><h4 class="code-header">pub const fn <a href="#method.is_positive" class="fnname">is_positive</a>(self) -> bool</h4></section></summary><div class="docblock"><p>Check if the offset is positive, or east of UTC.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert!</span>(<span class="macro">offset!</span>(+<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).is_positive()); |
| <span class="macro">assert!</span>(!<span class="macro">offset!</span>(-<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).is_positive()); |
| <span class="macro">assert!</span>(!<span class="macro">offset!</span>(UTC).is_positive());</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%0Ause%20time_macros%3A%3Aoffset%3B%0Aassert!(offset!(%2B1%3A02%3A03).is_positive())%3B%0Aassert!(!offset!(-1%3A02%3A03).is_positive())%3B%0Aassert!(!offset!(UTC).is_positive())%3B%0A%7D&edition=2021">Run</a></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_negative" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#244-246">source</a><h4 class="code-header">pub const fn <a href="#method.is_negative" class="fnname">is_negative</a>(self) -> bool</h4></section></summary><div class="docblock"><p>Check if the offset is negative, or west of UTC.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert!</span>(!<span class="macro">offset!</span>(+<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).is_negative()); |
| <span class="macro">assert!</span>(<span class="macro">offset!</span>(-<span class="number">1</span>:<span class="number">02</span>:<span class="number">03</span>).is_negative()); |
| <span class="macro">assert!</span>(!<span class="macro">offset!</span>(UTC).is_negative());</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%0Ause%20time_macros%3A%3Aoffset%3B%0Aassert!(!offset!(%2B1%3A02%3A03).is_negative())%3B%0Aassert!(offset!(-1%3A02%3A03).is_negative())%3B%0Aassert!(!offset!(UTC).is_negative())%3B%0A%7D&edition=2021">Run</a></div> |
| </div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-UtcOffset-1" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#285-307">source</a><a href="#impl-UtcOffset-1" class="anchor"></a><h3 class="code-header">impl <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.format_into" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#287-293">source</a><h4 class="code-header">pub fn <a href="#method.format_into" class="fnname">format_into</a>(<br> self,<br> output: &mut impl Write,<br> format: &impl <a class="trait" href="formatting/trait.Formattable.html" title="trait time::formatting::Formattable">Formattable</a> + ?Sized<br>) -> Result<usize, <a class="enum" href="error/enum.Format.html" title="enum time::error::Format">Format</a>></h4></section></summary><div class="docblock"><p>Format the <code>UtcOffset</code> using the provided <a href="format_description/index.html">format description</a>.</p> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.format" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#304-306">source</a><h4 class="code-header">pub fn <a href="#method.format" class="fnname">format</a>(self, format: &impl <a class="trait" href="formatting/trait.Formattable.html" title="trait time::formatting::Formattable">Formattable</a> + ?Sized) -> Result<String, <a class="enum" href="error/enum.Format.html" title="enum time::error::Format">Format</a>></h4></section></summary><div class="docblock"><p>Format the <code>UtcOffset</code> using the provided <a href="format_description/index.html">format description</a>.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>format = format_description::parse(<span class="string">"[offset_hour sign:mandatory]:[offset_minute]"</span>)<span class="question-mark">?</span>; |
| <span class="macro">assert_eq!</span>(<span class="macro">offset!</span>(+<span class="number">1</span>).format(<span class="kw-2">&</span>format)<span class="question-mark">?</span>, <span class="string">"+01:00"</span>);</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%20fn%20_inner()%20-%3E%20Result%3C()%2C%20impl%20core%3A%3Afmt%3A%3ADebug%3E%20%7B%0Ause%20time%3A%3Aformat_description%3B%0Ause%20time_macros%3A%3Aoffset%3B%0Alet%20format%20%3D%20format_description%3A%3Aparse(%22%5Boffset_hour%20sign%3Amandatory%5D%3A%5Boffset_minute%5D%22)%3F%3B%0Aassert_eq!(offset!(%2B1).format(%26format)%3F%2C%20%22%2B01%3A00%22)%3B%0AOk%3A%3A%3C_%2C%20time%3A%3AError%3E(())%0A%7D%20_inner().unwrap()%20%7D&edition=2021">Run</a></div> |
| </div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-UtcOffset-2" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#310-327">source</a><a href="#impl-UtcOffset-2" class="anchor"></a><h3 class="code-header">impl <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.parse" class="method has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#321-326">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fnname">parse</a>(<br> input: &str,<br> description: &impl <a class="trait" href="parsing/trait.Parsable.html" title="trait time::parsing::Parsable">Parsable</a> + ?Sized<br>) -> Result<Self, <a class="enum" href="error/enum.Parse.html" title="enum time::error::Parse">Parse</a>></h4></section></summary><div class="docblock"><p>Parse a <code>UtcOffset</code> from the input using the provided <a href="format_description/index.html">format |
| description</a>.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>format = <span class="macro">format_description!</span>(<span class="string">"[offset_hour]:[offset_minute]"</span>); |
| <span class="macro">assert_eq!</span>(UtcOffset::parse(<span class="string">"-03:42"</span>, <span class="kw-2">&</span>format)<span class="question-mark">?</span>, <span class="macro">offset!</span>(-<span class="number">3</span>:<span class="number">42</span>));</code></pre><a class="test-arrow" target="_blank" href="https://play.rust-lang.org?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23time%3B%0Afn%20main()%20%7B%20fn%20_inner()%20-%3E%20Result%3C()%2C%20impl%20core%3A%3Afmt%3A%3ADebug%3E%20%7B%0Ause%20time%3A%3AUtcOffset%3B%0Ause%20time_macros%3A%3A%7Boffset%2C%20format_description%7D%3B%0Alet%20format%20%3D%20format_description!(%22%5Boffset_hour%5D%3A%5Boffset_minute%5D%22)%3B%0Aassert_eq!(UtcOffset%3A%3Aparse(%22-03%3A42%22%2C%20%26format)%3F%2C%20offset!(-3%3A42))%3B%0AOk%3A%3A%3C_%2C%20time%3A%3AError%3E(())%0A%7D%20_inner().unwrap()%20%7D&edition=2021">Run</a></div> |
| </div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Clone-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#impl-Clone-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl Clone for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#method.clone" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone</a>(&self) -> <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">clone_from</a>(&mut self, source: &Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Debug-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#342-346">source</a><a href="#impl-Debug-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl Debug for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#343-345">source</a><a href="#method.fmt-1" class="anchor"></a><h4 class="code-header">fn <a class="fnname">fmt</a>(&self, f: &mut Formatter<'_>) -> Result</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Deserialize%3C%27a%3E-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/serde/mod.rs.html#432-440">source</a><a href="#impl-Deserialize%3C%27a%3E-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl<'a> <a class="trait" href="../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a><'a> for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.deserialize" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/time/serde/mod.rs.html#433-439">source</a><a href="#method.deserialize" class="anchor"></a><h4 class="code-header">fn <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize" class="fnname">deserialize</a><D: <a class="trait" href="../serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a><'a>>(deserializer: D) -> Result<Self, D::<a class="associatedtype" href="../serde/de/trait.Deserializer.html#associatedtype.Error" title="type serde::de::Deserializer::Error">Error</a>></h4></section></summary><div class='docblock'>Deserialize this value from the given Serde deserializer. <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Display-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#329-340">source</a><a href="#impl-Display-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl Display for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#330-339">source</a><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a class="fnname">fmt</a>(&self, f: &mut Formatter<'_>) -> Result</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Hash-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#impl-Hash-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl Hash for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.hash" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#method.hash" class="anchor"></a><h4 class="code-header">fn <a class="fnname">hash</a><__H: Hasher>(&self, state: &mut __H)</h4></section></summary><div class='docblock'>Feeds this value into the given [<code>Hasher</code>]. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.hash_slice" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.3.0">1.3.0</span><a href="#method.hash_slice" class="anchor"></a><h4 class="code-header">fn <a class="fnname">hash_slice</a><H>(data: &[Self], state: &mut H)<span class="where fmt-newline">where<br> H: Hasher,</span></h4></section></summary><div class='docblock'>Feeds a slice of this type into the given [<code>Hasher</code>]. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Neg-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#349-355">source</a><a href="#impl-Neg-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl Neg for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Output</a> = <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.neg" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#352-354">source</a><a href="#method.neg" class="anchor"></a><h4 class="code-header">fn <a class="fnname">neg</a>(self) -> Self::Output</h4></section></summary><div class='docblock'>Performs the unary <code>-</code> operation. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Ord-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#impl-Ord-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl Ord for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#method.cmp" class="anchor"></a><h4 class="code-header">fn <a class="fnname">cmp</a>(&self, other: &<a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a>) -> Ordering</h4></section></summary><div class='docblock'>This method returns an [<code>Ordering</code>] between <code>self</code> and <code>other</code>. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.max" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.21.0">1.21.0</span><a href="#method.max" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">max</a>(self, other: Self) -> Self</h4></section></summary><div class='docblock'>Compares and returns the maximum of two values. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.min" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.21.0">1.21.0</span><a href="#method.min" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">min</a>(self, other: Self) -> Self</h4></section></summary><div class='docblock'>Compares and returns the minimum of two values. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clamp" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.50.0">1.50.0</span><a href="#method.clamp" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">clamp</a>(self, min: Self, max: Self) -> Self<span class="where fmt-newline">where<br> Self: PartialOrd<Self>,</span></h4></section></summary><div class='docblock'>Restrict a value to a certain interval. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CUtcOffset%3E-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#impl-PartialEq%3CUtcOffset%3E-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl PartialEq<<a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a>> for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#method.eq" class="anchor"></a><h4 class="code-header">fn <a class="fnname">eq</a>(&self, other: &<a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a>) -> bool</h4></section></summary><div class='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used |
| by <code>==</code>. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.ne" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">ne</a>(&self, other: &Rhs) -> bool</h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always |
| sufficient, and should not be overridden without very good reason. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CUtcOffset%3E-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#impl-PartialOrd%3CUtcOffset%3E-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl PartialOrd<<a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a>> for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#method.partial_cmp" class="anchor"></a><h4 class="code-header">fn <a class="fnname">partial_cmp</a>(&self, other: &<a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a>) -> Option<Ordering></h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.lt" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.lt" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">lt</a>(&self, other: &Rhs) -> bool</h4></section></summary><div class='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.le" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.le" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">le</a>(&self, other: &Rhs) -> bool</h4></section></summary><div class='docblock'>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> |
| operator. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.gt" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.gt" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">gt</a>(&self, other: &Rhs) -> bool</h4></section></summary><div class='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ge" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.ge" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">ge</a>(&self, other: &Rhs) -> bool</h4></section></summary><div class='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> |
| operator. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Serialize-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/serde/mod.rs.html#413-430">source</a><a href="#impl-Serialize-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="../serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a> for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.serialize" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/time/serde/mod.rs.html#414-429">source</a><a href="#method.serialize" class="anchor"></a><h4 class="code-header">fn <a href="../serde/ser/trait.Serialize.html#tymethod.serialize" class="fnname">serialize</a><S: <a class="trait" href="../serde/ser/trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a>>(&self, serializer: S) -> Result<S::<a class="associatedtype" href="../serde/ser/trait.Serializer.html#associatedtype.Ok" title="type serde::ser::Serializer::Ok">Ok</a>, S::<a class="associatedtype" href="../serde/ser/trait.Serializer.html#associatedtype.Error" title="type serde::ser::Serializer::Error">Error</a>></h4></section></summary><div class='docblock'>Serialize this value into the given Serde serializer. <a href="../serde/ser/trait.Serialize.html#tymethod.serialize">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-TryFrom%3CParsed%3E-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/parsing/parsed.rs.html#752-772">source</a><a href="#impl-TryFrom%3CParsed%3E-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl TryFrom<<a class="struct" href="parsing/struct.Parsed.html" title="struct time::parsing::Parsed">Parsed</a>> for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = <a class="enum" href="error/enum.TryFromParsed.html" title="enum time::error::TryFromParsed">TryFromParsed</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/time/parsing/parsed.rs.html#755-771">source</a><a href="#method.try_from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(parsed: <a class="struct" href="parsing/struct.Parsed.html" title="struct time::parsing::Parsed">Parsed</a>) -> Result<Self, Self::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><section id="impl-Copy-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#impl-Copy-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl Copy for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section><section id="impl-Eq-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#impl-Eq-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl Eq for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section><section id="impl-StructuralEq-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#impl-StructuralEq-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl StructuralEq for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section><section id="impl-StructuralPartialEq-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/time/utc_offset.rs.html#24">source</a><a href="#impl-StructuralPartialEq-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl StructuralPartialEq for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-UtcOffset" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl RefUnwindSafe for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section><section id="impl-Send-for-UtcOffset" class="impl has-srclink"><a href="#impl-Send-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl Send for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section><section id="impl-Sync-for-UtcOffset" class="impl has-srclink"><a href="#impl-Sync-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl Sync for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section><section id="impl-Unpin-for-UtcOffset" class="impl has-srclink"><a href="#impl-Unpin-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl Unpin for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section><section id="impl-UnwindSafe-for-UtcOffset" class="impl has-srclink"><a href="#impl-UnwindSafe-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl UnwindSafe for <a class="struct" href="struct.UtcOffset.html" title="struct time::UtcOffset">UtcOffset</a></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Any-for-UtcOffset" class="impl has-srclink"><a href="#impl-Any-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl<T> Any for T<span class="where fmt-newline">where<br> T: 'static + ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl has-srclink"><a href="#method.type_id" class="anchor"></a><h4 class="code-header">fn <a class="fnname">type_id</a>(&self) -> TypeId</h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-UtcOffset" class="impl has-srclink"><a href="#impl-Borrow%3CT%3E-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl<T> Borrow<T> for T<span class="where fmt-newline">where<br> T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow</a>(&self) -> &T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-UtcOffset" class="impl has-srclink"><a href="#impl-BorrowMut%3CT%3E-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl<T> BorrowMut<T> for T<span class="where fmt-newline">where<br> T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow_mut</a>(&mut self) -> &mut T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-UtcOffset" class="impl has-srclink"><a href="#impl-From%3CT%3E-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl<T> From<T> for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p> |
| </div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-UtcOffset" class="impl has-srclink"><a href="#impl-Into%3CU%3E-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl<T, U> Into<U> for T<span class="where fmt-newline">where<br> U: From<T>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p> |
| <p>That is, this conversion is whatever the implementation of |
| <code>[From]<T> for U</code> chooses to do.</p> |
| </div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToOwned-for-UtcOffset" class="impl has-srclink"><a href="#impl-ToOwned-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl<T> ToOwned for T<span class="where fmt-newline">where<br> T: Clone,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Owned" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl has-srclink"><a href="#method.to_owned" class="anchor"></a><h4 class="code-header">fn <a class="fnname">to_owned</a>(&self) -> T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl has-srclink"><a href="#method.clone_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone_into</a>(&self, target: &mut T)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToString-for-UtcOffset" class="impl has-srclink"><a href="#impl-ToString-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl<T> ToString for T<span class="where fmt-newline">where<br> T: Display + ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_string" class="method trait-impl has-srclink"><a href="#method.to_string" class="anchor"></a><h4 class="code-header">default fn <a class="fnname">to_string</a>(&self) -> String</h4></section></summary><div class='docblock'>Converts the given value to a <code>String</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-UtcOffset" class="impl has-srclink"><a href="#impl-TryFrom%3CU%3E-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl<T, U> TryFrom<U> for T<span class="where fmt-newline">where<br> U: Into<T>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-2" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-2" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = Infallible</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from-1" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_from-1" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(value: U) -> Result<T, <T as TryFrom<U>>::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-UtcOffset" class="impl has-srclink"><a href="#impl-TryInto%3CU%3E-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl<T, U> TryInto<U> for T<span class="where fmt-newline">where<br> U: TryFrom<T>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = <U as TryFrom<T>>::Error</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_into</a>(self) -> Result<U, <U as TryFrom<T>>::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><section id="impl-DeserializeOwned-for-UtcOffset" class="impl has-srclink"><a class="srclink rightside" href="../src/serde/de/mod.rs.html#604">source</a><a href="#impl-DeserializeOwned-for-UtcOffset" class="anchor"></a><h3 class="code-header">impl<T> <a class="trait" href="../serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a> for T<span class="where fmt-newline">where<br> T: for<'de> <a class="trait" href="../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a><'de>,</span></h3></section></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> |