edlang/serde/de/value/index.html
2024-04-13 08:42:00 +00:00

40 lines
13 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="Building blocks for deserializing basic values using the `IntoDeserializer` trait."><title>serde::de::value - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-5bc39a1768837dd0.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.77.2 (25ef9e3d8 2024-04-09)" data-channel="1.77.2" data-search-js="search-dd67cee4cfa65049.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../../static.files/storage-4c98445ec4002617.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-48f368f3872407c8.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-04d5337699b92874.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../serde/index.html">serde</a><span class="version">1.0.197</span></h2></div><h2 class="location"><a href="#">Module value</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li></ul></section><h2><a href="../index.html">In serde::de</a></h2></div></nav><div class="sidebar-resizer"></div>
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../serde/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../../index.html">serde</a>::<wbr><a href="../index.html">de</a>::<wbr><a class="mod" href="#">value</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../../src/serde/de/value.rs.html#1-1720">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Building blocks for deserializing basic values using the <code>IntoDeserializer</code>
trait.</p>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::de::{value, Deserialize, IntoDeserializer};
<span class="kw">use </span>serde_derive::Deserialize;
<span class="kw">use </span>std::str::FromStr;
<span class="attr">#[derive(Deserialize)]
</span><span class="kw">enum </span>Setting {
On,
Off,
}
<span class="kw">impl </span>FromStr <span class="kw">for </span>Setting {
<span class="kw">type </span><span class="prelude-val">Err </span>= value::Error;
<span class="kw">fn </span>from_str(s: <span class="kw-2">&amp;</span>str) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, <span class="self">Self</span>::Err&gt; {
<span class="self">Self</span>::deserialize(s.into_deserializer())
}
}</code></pre></div>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.BoolDeserializer.html" title="struct serde::de::value::BoolDeserializer">BoolDeserializer</a></div><div class="desc docblock-short">A deserializer holding
a <code>bool</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.BorrowedBytesDeserializer.html" title="struct serde::de::value::BorrowedBytesDeserializer">BorrowedBytesDeserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>&amp;[u8]</code> with a lifetime tied to another
deserializer. Always calls <a href="../trait.Visitor.html#method.visit_borrowed_bytes" title="method serde::de::Visitor::visit_borrowed_bytes"><code>Visitor::visit_borrowed_bytes</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.BorrowedStrDeserializer.html" title="struct serde::de::value::BorrowedStrDeserializer">BorrowedStrDeserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>&amp;str</code> with a lifetime tied to another
deserializer.</div></li><li><div class="item-name"><a class="struct" href="struct.BytesDeserializer.html" title="struct serde::de::value::BytesDeserializer">BytesDeserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>&amp;[u8]</code>. Always calls <a href="../trait.Visitor.html#method.visit_bytes" title="method serde::de::Visitor::visit_bytes"><code>Visitor::visit_bytes</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.CharDeserializer.html" title="struct serde::de::value::CharDeserializer">CharDeserializer</a></div><div class="desc docblock-short">A deserializer holding
a <code>char</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.CowStrDeserializer.html" title="struct serde::de::value::CowStrDeserializer">CowStrDeserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>Cow&lt;str&gt;</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.EnumAccessDeserializer.html" title="struct serde::de::value::EnumAccessDeserializer">EnumAccessDeserializer</a></div><div class="desc docblock-short">A deserializer holding an <code>EnumAccess</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.Error.html" title="struct serde::de::value::Error">Error</a></div><div class="desc docblock-short">A minimal representation of all possible errors that can occur using the
<code>IntoDeserializer</code> trait.</div></li><li><div class="item-name"><a class="struct" href="struct.F32Deserializer.html" title="struct serde::de::value::F32Deserializer">F32Deserializer</a></div><div class="desc docblock-short">A deserializer holding
an <code>f32</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.F64Deserializer.html" title="struct serde::de::value::F64Deserializer">F64Deserializer</a></div><div class="desc docblock-short">A deserializer holding
an <code>f64</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.I8Deserializer.html" title="struct serde::de::value::I8Deserializer">I8Deserializer</a></div><div class="desc docblock-short">A deserializer holding
an <code>i8</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.I16Deserializer.html" title="struct serde::de::value::I16Deserializer">I16Deserializer</a></div><div class="desc docblock-short">A deserializer holding
an <code>i16</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.I32Deserializer.html" title="struct serde::de::value::I32Deserializer">I32Deserializer</a></div><div class="desc docblock-short">A deserializer holding
an <code>i32</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.I64Deserializer.html" title="struct serde::de::value::I64Deserializer">I64Deserializer</a></div><div class="desc docblock-short">A deserializer holding
an <code>i64</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.I128Deserializer.html" title="struct serde::de::value::I128Deserializer">I128Deserializer</a></div><div class="desc docblock-short">A deserializer holding
an <code>i128</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.IsizeDeserializer.html" title="struct serde::de::value::IsizeDeserializer">IsizeDeserializer</a></div><div class="desc docblock-short">A deserializer holding
an <code>isize</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.MapAccessDeserializer.html" title="struct serde::de::value::MapAccessDeserializer">MapAccessDeserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>MapAccess</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.MapDeserializer.html" title="struct serde::de::value::MapDeserializer">MapDeserializer</a></div><div class="desc docblock-short">A deserializer that iterates over a map.</div></li><li><div class="item-name"><a class="struct" href="struct.SeqAccessDeserializer.html" title="struct serde::de::value::SeqAccessDeserializer">SeqAccessDeserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>SeqAccess</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.SeqDeserializer.html" title="struct serde::de::value::SeqDeserializer">SeqDeserializer</a></div><div class="desc docblock-short">A deserializer that iterates over a sequence.</div></li><li><div class="item-name"><a class="struct" href="struct.StrDeserializer.html" title="struct serde::de::value::StrDeserializer">StrDeserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>&amp;str</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.StringDeserializer.html" title="struct serde::de::value::StringDeserializer">StringDeserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>String</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.U8Deserializer.html" title="struct serde::de::value::U8Deserializer">U8Deserializer</a></div><div class="desc docblock-short">A deserializer holding
a <code>u8</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.U16Deserializer.html" title="struct serde::de::value::U16Deserializer">U16Deserializer</a></div><div class="desc docblock-short">A deserializer holding
a <code>u16</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.U32Deserializer.html" title="struct serde::de::value::U32Deserializer">U32Deserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>u32</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.U64Deserializer.html" title="struct serde::de::value::U64Deserializer">U64Deserializer</a></div><div class="desc docblock-short">A deserializer holding
a <code>u64</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.U128Deserializer.html" title="struct serde::de::value::U128Deserializer">U128Deserializer</a></div><div class="desc docblock-short">A deserializer holding
a <code>u128</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.UnitDeserializer.html" title="struct serde::de::value::UnitDeserializer">UnitDeserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>()</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.UsizeDeserializer.html" title="struct serde::de::value::UsizeDeserializer">UsizeDeserializer</a></div><div class="desc docblock-short">A deserializer holding
a <code>usize</code>.</div></li></ul></section></div></main></body></html>