mirror of
https://github.com/edg-l/edlang.git
synced 2024-11-23 16:38:24 +00:00
237 lines
58 KiB
HTML
237 lines
58 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="This trait represents a visitor that walks through a deserializer."><title>Visitor in serde::de - Rust</title><script> if (window.location.protocol !== "file:") document.write(`<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">`)</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-e935ef01ae1c1829.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.78.0 (9b00956e5 2024-04-29)" data-channel="1.78.0" data-search-js="search-42d8da7a6b9792c2.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-12cf3b4f4f9dc36d.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 trait"><!--[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.200</span></h2></div><h2 class="location"><a href="#">Visitor</a></h2><div class="sidebar-elems"><section><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Value">Value</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.expecting">expecting</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.visit_bool">visit_bool</a></li><li><a href="#method.visit_borrowed_bytes">visit_borrowed_bytes</a></li><li><a href="#method.visit_borrowed_str">visit_borrowed_str</a></li><li><a href="#method.visit_byte_buf">visit_byte_buf</a></li><li><a href="#method.visit_bytes">visit_bytes</a></li><li><a href="#method.visit_char">visit_char</a></li><li><a href="#method.visit_enum">visit_enum</a></li><li><a href="#method.visit_f32">visit_f32</a></li><li><a href="#method.visit_f64">visit_f64</a></li><li><a href="#method.visit_i128">visit_i128</a></li><li><a href="#method.visit_i16">visit_i16</a></li><li><a href="#method.visit_i32">visit_i32</a></li><li><a href="#method.visit_i64">visit_i64</a></li><li><a href="#method.visit_i8">visit_i8</a></li><li><a href="#method.visit_map">visit_map</a></li><li><a href="#method.visit_newtype_struct">visit_newtype_struct</a></li><li><a href="#method.visit_none">visit_none</a></li><li><a href="#method.visit_seq">visit_seq</a></li><li><a href="#method.visit_some">visit_some</a></li><li><a href="#method.visit_str">visit_str</a></li><li><a href="#method.visit_string">visit_string</a></li><li><a href="#method.visit_u128">visit_u128</a></li><li><a href="#method.visit_u16">visit_u16</a></li><li><a href="#method.visit_u32">visit_u32</a></li><li><a href="#method.visit_u64">visit_u64</a></li><li><a href="#method.visit_u8">visit_u8</a></li><li><a href="#method.visit_unit">visit_unit</a></li></ul><h3><a href="#object-safety">Object Safety</a></h3><h3><a href="#implementors">Implementors</a></h3></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>Trait <a href="../index.html">serde</a>::<wbr><a href="index.html">de</a>::<wbr><a class="trait" href="#">Visitor</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/mod.rs.html#1278-1681">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub trait Visitor<'de>: <a class="trait" href="https://doc.rust-lang.org/1.78.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
|
||
type <a href="#associatedtype.Value" class="associatedtype">Value</a>;
|
||
|
||
<details class="toggle type-contents-toggle"><summary class="hideme"><span>Show 28 methods</span></summary> // Required method
|
||
fn <a href="#tymethod.expecting" class="fn">expecting</a>(&self, formatter: &mut <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.78.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a>;
|
||
|
||
// Provided methods
|
||
fn <a href="#method.visit_bool" class="fn">visit_bool</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.bool.html">bool</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_i8" class="fn">visit_i8</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.i8.html">i8</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_i16" class="fn">visit_i16</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.i16.html">i16</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_i32" class="fn">visit_i32</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.i32.html">i32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_i64" class="fn">visit_i64</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.i64.html">i64</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_i128" class="fn">visit_i128</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.i128.html">i128</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_u8" class="fn">visit_u8</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u8.html">u8</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_u16" class="fn">visit_u16</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u16.html">u16</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_u32" class="fn">visit_u32</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_u64" class="fn">visit_u64</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u64.html">u64</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_u128" class="fn">visit_u128</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u128.html">u128</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_f32" class="fn">visit_f32</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.f32.html">f32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_f64" class="fn">visit_f64</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.f64.html">f64</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_char" class="fn">visit_char</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.char.html">char</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_str" class="fn">visit_str</a><E>(self, v: &<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_borrowed_str" class="fn">visit_borrowed_str</a><E>(self, v: &'de <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_string" class="fn">visit_string</a><E>(self, v: <a class="struct" href="https://doc.rust-lang.org/1.78.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_bytes" class="fn">visit_bytes</a><E>(self, v: &[<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_borrowed_bytes" class="fn">visit_borrowed_bytes</a><E>(self, v: &'de [<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_byte_buf" class="fn">visit_byte_buf</a><E>(self, v: <a class="struct" href="https://doc.rust-lang.org/1.78.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u8.html">u8</a>>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_none" class="fn">visit_none</a><E>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_some" class="fn">visit_some</a><D>(self, deserializer: D) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, D::<a class="associatedtype" href="../trait.Deserializer.html#associatedtype.Error" title="type serde::Deserializer::Error">Error</a>>
|
||
<span class="where">where D: <a class="trait" href="../trait.Deserializer.html" title="trait serde::Deserializer">Deserializer</a><'de></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_unit" class="fn">visit_unit</a><E>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E>
|
||
<span class="where">where E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_newtype_struct" class="fn">visit_newtype_struct</a><D>(
|
||
self,
|
||
deserializer: D
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, D::<a class="associatedtype" href="../trait.Deserializer.html#associatedtype.Error" title="type serde::Deserializer::Error">Error</a>>
|
||
<span class="where">where D: <a class="trait" href="../trait.Deserializer.html" title="trait serde::Deserializer">Deserializer</a><'de></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_seq" class="fn">visit_seq</a><A>(self, seq: A) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, A::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde::de::SeqAccess::Error">Error</a>>
|
||
<span class="where">where A: <a class="trait" href="trait.SeqAccess.html" title="trait serde::de::SeqAccess">SeqAccess</a><'de></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_map" class="fn">visit_map</a><A>(self, map: A) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, A::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>>
|
||
<span class="where">where A: <a class="trait" href="trait.MapAccess.html" title="trait serde::de::MapAccess">MapAccess</a><'de></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.visit_enum" class="fn">visit_enum</a><A>(self, data: A) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, A::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde::de::EnumAccess::Error">Error</a>>
|
||
<span class="where">where A: <a class="trait" href="trait.EnumAccess.html" title="trait serde::de::EnumAccess">EnumAccess</a><'de></span> { ... }
|
||
</details>}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This trait represents a visitor that walks through a deserializer.</p>
|
||
<h2 id="lifetime"><a class="doc-anchor" href="#lifetime">§</a>Lifetime</h2>
|
||
<p>The <code>'de</code> lifetime of this trait is the requirement for lifetime of data
|
||
that may be borrowed by <code>Self::Value</code>. See the page <a href="https://serde.rs/lifetimes.html">Understanding
|
||
deserializer lifetimes</a> for a more detailed explanation of these lifetimes.</p>
|
||
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
||
<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="doccomment">/// A visitor that deserializes a long string - a string containing at least
|
||
/// some minimum number of bytes.
|
||
</span><span class="kw">struct </span>LongString {
|
||
min: usize,
|
||
}
|
||
|
||
<span class="kw">impl</span><<span class="lifetime">'de</span>> Visitor<<span class="lifetime">'de</span>> <span class="kw">for </span>LongString {
|
||
<span class="kw">type </span>Value = String;
|
||
|
||
<span class="kw">fn </span>expecting(<span class="kw-2">&</span><span class="self">self</span>, formatter: <span class="kw-2">&mut </span>fmt::Formatter) -> fmt::Result {
|
||
<span class="macro">write!</span>(formatter, <span class="string">"a string containing at least {} bytes"</span>, <span class="self">self</span>.min)
|
||
}
|
||
|
||
<span class="kw">fn </span>visit_str<E>(<span class="self">self</span>, s: <span class="kw-2">&</span>str) -> <span class="prelude-ty">Result</span><<span class="self">Self</span>::Value, E>
|
||
<span class="kw">where
|
||
</span>E: de::Error,
|
||
{
|
||
<span class="kw">if </span>s.len() >= <span class="self">self</span>.min {
|
||
<span class="prelude-val">Ok</span>(s.to_owned())
|
||
} <span class="kw">else </span>{
|
||
<span class="prelude-val">Err</span>(de::Error::invalid_value(Unexpected::Str(s), <span class="kw-2">&</span><span class="self">self</span>))
|
||
}
|
||
}
|
||
}</code></pre></div>
|
||
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Value" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1280">source</a><h4 class="code-header">type <a href="#associatedtype.Value" class="associatedtype">Value</a></h4></section></summary><div class="docblock"><p>The value produced by this visitor.</p>
|
||
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.expecting" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1304">source</a><h4 class="code-header">fn <a href="#tymethod.expecting" class="fn">expecting</a>(&self, formatter: &mut <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.78.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class="docblock"><p>Format a message stating what data this Visitor expects to receive.</p>
|
||
<p>This is used in error messages. The message should complete the sentence
|
||
“This Visitor expects to receive …”, for example the message could be
|
||
“an integer between 0 and 64”. The message should not be capitalized and
|
||
should not end with a period.</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">fn </span>expecting(<span class="kw-2">&</span><span class="self">self</span>, formatter: <span class="kw-2">&mut </span>fmt::Formatter) -> fmt::Result {
|
||
<span class="macro">write!</span>(formatter, <span class="string">"an integer between 0 and {}"</span>, <span class="self">self</span>.max)
|
||
}</code></pre></div>
|
||
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.visit_bool" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1309-1314">source</a><h4 class="code-header">fn <a href="#method.visit_bool" class="fn">visit_bool</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.bool.html">bool</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a boolean.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_i8" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1321-1326">source</a><h4 class="code-header">fn <a href="#method.visit_i8" class="fn">visit_i8</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.i8.html">i8</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains an <code>i8</code>.</p>
|
||
<p>The default implementation forwards to <a href="#method.visit_i64"><code>visit_i64</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_i16" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1333-1338">source</a><h4 class="code-header">fn <a href="#method.visit_i16" class="fn">visit_i16</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.i16.html">i16</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains an <code>i16</code>.</p>
|
||
<p>The default implementation forwards to <a href="#method.visit_i64"><code>visit_i64</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_i32" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1345-1350">source</a><h4 class="code-header">fn <a href="#method.visit_i32" class="fn">visit_i32</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.i32.html">i32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains an <code>i32</code>.</p>
|
||
<p>The default implementation forwards to <a href="#method.visit_i64"><code>visit_i64</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_i64" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1355-1360">source</a><h4 class="code-header">fn <a href="#method.visit_i64" class="fn">visit_i64</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.i64.html">i64</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains an <code>i64</code>.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_i128" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1365-1376">source</a><h4 class="code-header">fn <a href="#method.visit_i128" class="fn">visit_i128</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.i128.html">i128</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a <code>i128</code>.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_u8" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1383-1388">source</a><h4 class="code-header">fn <a href="#method.visit_u8" class="fn">visit_u8</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u8.html">u8</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a <code>u8</code>.</p>
|
||
<p>The default implementation forwards to <a href="#method.visit_u64"><code>visit_u64</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_u16" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1395-1400">source</a><h4 class="code-header">fn <a href="#method.visit_u16" class="fn">visit_u16</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u16.html">u16</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a <code>u16</code>.</p>
|
||
<p>The default implementation forwards to <a href="#method.visit_u64"><code>visit_u64</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_u32" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1407-1412">source</a><h4 class="code-header">fn <a href="#method.visit_u32" class="fn">visit_u32</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a <code>u32</code>.</p>
|
||
<p>The default implementation forwards to <a href="#method.visit_u64"><code>visit_u64</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_u64" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1417-1422">source</a><h4 class="code-header">fn <a href="#method.visit_u64" class="fn">visit_u64</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u64.html">u64</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a <code>u64</code>.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_u128" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1427-1438">source</a><h4 class="code-header">fn <a href="#method.visit_u128" class="fn">visit_u128</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u128.html">u128</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a <code>u128</code>.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_f32" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1445-1450">source</a><h4 class="code-header">fn <a href="#method.visit_f32" class="fn">visit_f32</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.f32.html">f32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains an <code>f32</code>.</p>
|
||
<p>The default implementation forwards to <a href="#method.visit_f64"><code>visit_f64</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_f64" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1455-1460">source</a><h4 class="code-header">fn <a href="#method.visit_f64" class="fn">visit_f64</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.f64.html">f64</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains an <code>f64</code>.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_char" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1469-1474">source</a><h4 class="code-header">fn <a href="#method.visit_char" class="fn">visit_char</a><E>(self, v: <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.char.html">char</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a <code>char</code>.</p>
|
||
<p>The default implementation forwards to <a href="#method.visit_str"><code>visit_str</code></a> as a one-character
|
||
string.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_str" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1487-1492">source</a><h4 class="code-header">fn <a href="#method.visit_str" class="fn">visit_str</a><E>(self, v: &<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a string. The lifetime of the string is ephemeral and
|
||
it may be destroyed after this method returns.</p>
|
||
<p>This method allows the <code>Deserializer</code> to avoid a copy by retaining
|
||
ownership of any buffered data. <code>Deserialize</code> implementations that do
|
||
not benefit from taking ownership of <code>String</code> data should indicate that
|
||
to the deserializer by using <code>Deserializer::deserialize_str</code> rather than
|
||
<code>Deserializer::deserialize_string</code>.</p>
|
||
<p>It is never correct to implement <code>visit_string</code> without implementing
|
||
<code>visit_str</code>. Implement neither, both, or just <code>visit_str</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_borrowed_str" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1504-1509">source</a><h4 class="code-header">fn <a href="#method.visit_borrowed_str" class="fn">visit_borrowed_str</a><E>(self, v: &'de <a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a string that lives at least as long as the
|
||
<code>Deserializer</code>.</p>
|
||
<p>This enables zero-copy deserialization of strings in some formats. For
|
||
example JSON input containing the JSON string <code>"borrowed"</code> can be
|
||
deserialized with zero copying into a <code>&'a str</code> as long as the input
|
||
data outlives <code>'a</code>.</p>
|
||
<p>The default implementation forwards to <code>visit_str</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_string" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1529-1534">source</a><h4 class="code-header">fn <a href="#method.visit_string" class="fn">visit_string</a><E>(self, v: <a class="struct" href="https://doc.rust-lang.org/1.78.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a string and ownership of the string is being given
|
||
to the <code>Visitor</code>.</p>
|
||
<p>This method allows the <code>Visitor</code> to avoid a copy by taking ownership of
|
||
a string created by the <code>Deserializer</code>. <code>Deserialize</code> implementations
|
||
that benefit from taking ownership of <code>String</code> data should indicate that
|
||
to the deserializer by using <code>Deserializer::deserialize_string</code> rather
|
||
than <code>Deserializer::deserialize_str</code>, although not every deserializer
|
||
will honor such a request.</p>
|
||
<p>It is never correct to implement <code>visit_string</code> without implementing
|
||
<code>visit_str</code>. Implement neither, both, or just <code>visit_str</code>.</p>
|
||
<p>The default implementation forwards to <code>visit_str</code> and then drops the
|
||
<code>String</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_bytes" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1547-1552">source</a><h4 class="code-header">fn <a href="#method.visit_bytes" class="fn">visit_bytes</a><E>(self, v: &[<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a byte array. The lifetime of the byte array is
|
||
ephemeral and it may be destroyed after this method returns.</p>
|
||
<p>This method allows the <code>Deserializer</code> to avoid a copy by retaining
|
||
ownership of any buffered data. <code>Deserialize</code> implementations that do
|
||
not benefit from taking ownership of <code>Vec<u8></code> data should indicate that
|
||
to the deserializer by using <code>Deserializer::deserialize_bytes</code> rather
|
||
than <code>Deserializer::deserialize_byte_buf</code>.</p>
|
||
<p>It is never correct to implement <code>visit_byte_buf</code> without implementing
|
||
<code>visit_bytes</code>. Implement neither, both, or just <code>visit_bytes</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_borrowed_bytes" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1563-1568">source</a><h4 class="code-header">fn <a href="#method.visit_borrowed_bytes" class="fn">visit_borrowed_bytes</a><E>(self, v: &'de [<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a byte array that lives at least as long as the
|
||
<code>Deserializer</code>.</p>
|
||
<p>This enables zero-copy deserialization of bytes in some formats. For
|
||
example Postcard data containing bytes can be deserialized with zero
|
||
copying into a <code>&'a [u8]</code> as long as the input data outlives <code>'a</code>.</p>
|
||
<p>The default implementation forwards to <code>visit_bytes</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_byte_buf" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1588-1593">source</a><h4 class="code-header">fn <a href="#method.visit_byte_buf" class="fn">visit_byte_buf</a><E>(self, v: <a class="struct" href="https://doc.rust-lang.org/1.78.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.u8.html">u8</a>>) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a byte array and ownership of the byte array is being
|
||
given to the <code>Visitor</code>.</p>
|
||
<p>This method allows the <code>Visitor</code> to avoid a copy by taking ownership of
|
||
a byte buffer created by the <code>Deserializer</code>. <code>Deserialize</code>
|
||
implementations that benefit from taking ownership of <code>Vec<u8></code> data
|
||
should indicate that to the deserializer by using
|
||
<code>Deserializer::deserialize_byte_buf</code> rather than
|
||
<code>Deserializer::deserialize_bytes</code>, although not every deserializer will
|
||
honor such a request.</p>
|
||
<p>It is never correct to implement <code>visit_byte_buf</code> without implementing
|
||
<code>visit_bytes</code>. Implement neither, both, or just <code>visit_bytes</code>.</p>
|
||
<p>The default implementation forwards to <code>visit_bytes</code> and then drops the
|
||
<code>Vec<u8></code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_none" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1598-1603">source</a><h4 class="code-header">fn <a href="#method.visit_none" class="fn">visit_none</a><E>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains an optional that is absent.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_some" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1608-1614">source</a><h4 class="code-header">fn <a href="#method.visit_some" class="fn">visit_some</a><D>(self, deserializer: D) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, D::<a class="associatedtype" href="../trait.Deserializer.html#associatedtype.Error" title="type serde::Deserializer::Error">Error</a>><div class="where">where
|
||
D: <a class="trait" href="../trait.Deserializer.html" title="trait serde::Deserializer">Deserializer</a><'de>,</div></h4></section></summary><div class="docblock"><p>The input contains an optional that is present.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_unit" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1619-1624">source</a><h4 class="code-header">fn <a href="#method.visit_unit" class="fn">visit_unit</a><E>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, E><div class="where">where
|
||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h4></section></summary><div class="docblock"><p>The input contains a unit <code>()</code>.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_newtype_struct" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1632-1638">source</a><h4 class="code-header">fn <a href="#method.visit_newtype_struct" class="fn">visit_newtype_struct</a><D>(
|
||
self,
|
||
deserializer: D
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, D::<a class="associatedtype" href="../trait.Deserializer.html#associatedtype.Error" title="type serde::Deserializer::Error">Error</a>><div class="where">where
|
||
D: <a class="trait" href="../trait.Deserializer.html" title="trait serde::Deserializer">Deserializer</a><'de>,</div></h4></section></summary><div class="docblock"><p>The input contains a newtype struct.</p>
|
||
<p>The content of the newtype struct may be read from the given
|
||
<code>Deserializer</code>.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_seq" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1643-1649">source</a><h4 class="code-header">fn <a href="#method.visit_seq" class="fn">visit_seq</a><A>(self, seq: A) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, A::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde::de::SeqAccess::Error">Error</a>><div class="where">where
|
||
A: <a class="trait" href="trait.SeqAccess.html" title="trait serde::de::SeqAccess">SeqAccess</a><'de>,</div></h4></section></summary><div class="docblock"><p>The input contains a sequence of elements.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_map" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1654-1660">source</a><h4 class="code-header">fn <a href="#method.visit_map" class="fn">visit_map</a><A>(self, map: A) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, A::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||
A: <a class="trait" href="trait.MapAccess.html" title="trait serde::de::MapAccess">MapAccess</a><'de>,</div></h4></section></summary><div class="docblock"><p>The input contains a key-value map.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.visit_enum" class="method"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1665-1671">source</a><h4 class="code-header">fn <a href="#method.visit_enum" class="fn">visit_enum</a><A>(self, data: A) -> <a class="enum" href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, A::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde::de::EnumAccess::Error">Error</a>><div class="where">where
|
||
A: <a class="trait" href="trait.EnumAccess.html" title="trait serde::de::EnumAccess">EnumAccess</a><'de>,</div></h4></section></summary><div class="docblock"><p>The input contains an enum.</p>
|
||
<p>The default implementation fails with a type error.</p>
|
||
</div></details></div><h2 id="object-safety" class="section-header">Object Safety<a href="#object-safety" class="anchor">§</a></h2><div class="object-safety-info">This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.78.0/reference/items/traits.html#object-safety">object safe</a>.</div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-Visitor%3C'de%3E-for-IgnoredAny" class="impl"><a class="src rightside" href="../../src/serde/de/ignored_any.rs.html#113-228">source</a><a href="#impl-Visitor%3C'de%3E-for-IgnoredAny" class="anchor">§</a><h3 class="code-header">impl<'de> <a class="trait" href="trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a><'de> for <a class="struct" href="struct.IgnoredAny.html" title="struct serde::de::IgnoredAny">IgnoredAny</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Value-1" class="associatedtype trait-impl"><a href="#associatedtype.Value-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Value" class="associatedtype">Value</a> = <a class="struct" href="struct.IgnoredAny.html" title="struct serde::de::IgnoredAny">IgnoredAny</a></h4></section></div></details></div><script src="../../trait.impl/serde/de/trait.Visitor.js" async></script></section></div></main></body></html> |