mpvrc/bincode/config/trait.Options.html

104 lines
No EOL
32 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="A configuration builder trait whose options Bincode will use while serializing and deserializing."><title>Options in bincode::config - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="bincode" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.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="../../bincode/index.html">bincode</a><span class="version">1.3.3</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Options</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#options" title="Options">Options</a></li><li><a href="#byte-limit-details" title="Byte Limit Details">Byte Limit Details</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.allow_trailing_bytes" title="allow_trailing_bytes">allow_trailing_bytes</a></li><li><a href="#method.deserialize" title="deserialize">deserialize</a></li><li><a href="#method.deserialize_from" title="deserialize_from">deserialize_from</a></li><li><a href="#method.deserialize_from_custom" title="deserialize_from_custom">deserialize_from_custom</a></li><li><a href="#method.deserialize_from_custom_seed" title="deserialize_from_custom_seed">deserialize_from_custom_seed</a></li><li><a href="#method.deserialize_from_seed" title="deserialize_from_seed">deserialize_from_seed</a></li><li><a href="#method.deserialize_seed" title="deserialize_seed">deserialize_seed</a></li><li><a href="#method.reject_trailing_bytes" title="reject_trailing_bytes">reject_trailing_bytes</a></li><li><a href="#method.serialize" title="serialize">serialize</a></li><li><a href="#method.serialize_into" title="serialize_into">serialize_into</a></li><li><a href="#method.serialized_size" title="serialized_size">serialized_size</a></li><li><a href="#method.with_big_endian" title="with_big_endian">with_big_endian</a></li><li><a href="#method.with_fixint_encoding" title="with_fixint_encoding">with_fixint_encoding</a></li><li><a href="#method.with_limit" title="with_limit">with_limit</a></li><li><a href="#method.with_little_endian" title="with_little_endian">with_little_endian</a></li><li><a href="#method.with_native_endian" title="with_native_endian">with_native_endian</a></li><li><a href="#method.with_no_limit" title="with_no_limit">with_no_limit</a></li><li><a href="#method.with_varint_encoding" title="with_varint_encoding">with_varint_encoding</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In bincode::<wbr>config</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">bincode</a>::<wbr><a href="index.html">config</a></span><h1>Trait <span class="trait">Options</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/bincode/config/mod.rs.html#128-270">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Options: InternalOptions + <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
<details class="toggle type-contents-toggle"><summary class="hideme"><span>Show 18 methods</span></summary> // Provided methods
fn <a href="#method.with_no_limit" class="fn">with_no_limit</a>(self) -&gt; <a class="struct" href="struct.WithOtherLimit.html" title="struct bincode::config::WithOtherLimit">WithOtherLimit</a>&lt;Self, <a class="struct" href="struct.Infinite.html" title="struct bincode::config::Infinite">Infinite</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.with_limit" class="fn">with_limit</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u64.html">u64</a>) -&gt; <a class="struct" href="struct.WithOtherLimit.html" title="struct bincode::config::WithOtherLimit">WithOtherLimit</a>&lt;Self, <a class="struct" href="struct.Bounded.html" title="struct bincode::config::Bounded">Bounded</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.with_little_endian" class="fn">with_little_endian</a>(self) -&gt; <a class="struct" href="struct.WithOtherEndian.html" title="struct bincode::config::WithOtherEndian">WithOtherEndian</a>&lt;Self, <a class="struct" href="struct.LittleEndian.html" title="struct bincode::config::LittleEndian">LittleEndian</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.with_big_endian" class="fn">with_big_endian</a>(self) -&gt; <a class="struct" href="struct.WithOtherEndian.html" title="struct bincode::config::WithOtherEndian">WithOtherEndian</a>&lt;Self, <a class="struct" href="struct.BigEndian.html" title="struct bincode::config::BigEndian">BigEndian</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.with_native_endian" class="fn">with_native_endian</a>(self) -&gt; <a class="struct" href="struct.WithOtherEndian.html" title="struct bincode::config::WithOtherEndian">WithOtherEndian</a>&lt;Self, <a class="struct" href="struct.NativeEndian.html" title="struct bincode::config::NativeEndian">NativeEndian</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.with_varint_encoding" class="fn">with_varint_encoding</a>(self) -&gt; <a class="struct" href="struct.WithOtherIntEncoding.html" title="struct bincode::config::WithOtherIntEncoding">WithOtherIntEncoding</a>&lt;Self, <a class="struct" href="struct.VarintEncoding.html" title="struct bincode::config::VarintEncoding">VarintEncoding</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.with_fixint_encoding" class="fn">with_fixint_encoding</a>(self) -&gt; <a class="struct" href="struct.WithOtherIntEncoding.html" title="struct bincode::config::WithOtherIntEncoding">WithOtherIntEncoding</a>&lt;Self, <a class="struct" href="struct.FixintEncoding.html" title="struct bincode::config::FixintEncoding">FixintEncoding</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.reject_trailing_bytes" class="fn">reject_trailing_bytes</a>(self) -&gt; <a class="struct" href="struct.WithOtherTrailing.html" title="struct bincode::config::WithOtherTrailing">WithOtherTrailing</a>&lt;Self, <a class="struct" href="struct.RejectTrailing.html" title="struct bincode::config::RejectTrailing">RejectTrailing</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.allow_trailing_bytes" class="fn">allow_trailing_bytes</a>(self) -&gt; <a class="struct" href="struct.WithOtherTrailing.html" title="struct bincode::config::WithOtherTrailing">WithOtherTrailing</a>&lt;Self, <a class="struct" href="struct.AllowTrailing.html" title="struct bincode::config::AllowTrailing">AllowTrailing</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.serialize" class="fn">serialize</a>&lt;S: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../../serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a>&gt;(self, t: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&amp;S</a>) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.84.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>&gt;&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.serialized_size" class="fn">serialized_size</a>&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../../serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a>&gt;(self, t: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u64.html">u64</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.serialize_into" class="fn">serialize_into</a>&lt;W: <a class="trait" href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html" title="trait std::io::Write">Write</a>, T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../../serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a>&gt;(
self,
w: W,
t: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&amp;T</a>,
) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.deserialize" class="fn">deserialize</a>&lt;'a, T: <a class="trait" href="../../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a>&lt;'a&gt;&gt;(self, bytes: &amp;'a [<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;T&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.deserialize_seed" class="fn">deserialize_seed</a>&lt;'a, T: <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a>&lt;'a&gt;&gt;(
self,
seed: T,
bytes: &amp;'a [<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>],
) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;T::<a class="associatedtype" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.deserialize_from" class="fn">deserialize_from</a>&lt;R: <a class="trait" href="https://doc.rust-lang.org/1.84.1/std/io/trait.Read.html" title="trait std::io::Read">Read</a>, T: <a class="trait" href="../../serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>&gt;(
self,
reader: R,
) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;T&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.deserialize_from_seed" class="fn">deserialize_from_seed</a>&lt;'a, R: <a class="trait" href="https://doc.rust-lang.org/1.84.1/std/io/trait.Read.html" title="trait std::io::Read">Read</a>, T: <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a>&lt;'a&gt;&gt;(
self,
seed: T,
reader: R,
) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;T::<a class="associatedtype" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.deserialize_from_custom" class="fn">deserialize_from_custom</a>&lt;'a, R: <a class="trait" href="../de/read/trait.BincodeRead.html" title="trait bincode::de::read::BincodeRead">BincodeRead</a>&lt;'a&gt;, T: <a class="trait" href="../../serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>&gt;(
self,
reader: R,
) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;T&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.deserialize_from_custom_seed" class="fn">deserialize_from_custom_seed</a>&lt;'a, R: <a class="trait" href="../de/read/trait.BincodeRead.html" title="trait bincode::de::read::BincodeRead">BincodeRead</a>&lt;'a&gt;, T: <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a>&lt;'a&gt;&gt;(
self,
seed: T,
reader: R,
) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;T::<a class="associatedtype" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>&gt; { ... }
</details>}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A configuration builder trait whose options Bincode will use
while serializing and deserializing.</p>
<h4 id="options"><a class="doc-anchor" href="#options">§</a>Options</h4>
<p>Endianness: The endianness with which multi-byte integers will be read/written. <em>default: little endian</em></p>
<p>Limit: The maximum number of bytes that will be read/written in a bincode serialize/deserialize. <em>default: unlimited</em></p>
<p>Int Encoding: The encoding used for numbers, enum discriminants, and lengths. <em>default: varint</em></p>
<p>Trailing Behavior: The behavior when there are trailing bytes left over in a slice after deserialization. <em>default: reject</em></p>
<h4 id="byte-limit-details"><a class="doc-anchor" href="#byte-limit-details">§</a>Byte Limit Details</h4>
<p>The purpose of byte-limiting is to prevent Denial-Of-Service attacks whereby malicious attackers get bincode
deserialization to crash your process by allocating too much memory or keeping a connection open for too long.</p>
<p>When a byte limit is set, bincode will return <code>Err</code> on any deserialization that goes over the limit, or any
serialization that goes over the limit.</p>
</div></details><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.with_no_limit" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#131-133">Source</a><h4 class="code-header">fn <a href="#method.with_no_limit" class="fn">with_no_limit</a>(self) -&gt; <a class="struct" href="struct.WithOtherLimit.html" title="struct bincode::config::WithOtherLimit">WithOtherLimit</a>&lt;Self, <a class="struct" href="struct.Infinite.html" title="struct bincode::config::Infinite">Infinite</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the byte limit to be unlimited.
This is the default.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_limit" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#136-138">Source</a><h4 class="code-header">fn <a href="#method.with_limit" class="fn">with_limit</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u64.html">u64</a>) -&gt; <a class="struct" href="struct.WithOtherLimit.html" title="struct bincode::config::WithOtherLimit">WithOtherLimit</a>&lt;Self, <a class="struct" href="struct.Bounded.html" title="struct bincode::config::Bounded">Bounded</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the byte limit to <code>limit</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_little_endian" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#142-144">Source</a><h4 class="code-header">fn <a href="#method.with_little_endian" class="fn">with_little_endian</a>(self) -&gt; <a class="struct" href="struct.WithOtherEndian.html" title="struct bincode::config::WithOtherEndian">WithOtherEndian</a>&lt;Self, <a class="struct" href="struct.LittleEndian.html" title="struct bincode::config::LittleEndian">LittleEndian</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the endianness to little-endian
This is the default.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_big_endian" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#147-149">Source</a><h4 class="code-header">fn <a href="#method.with_big_endian" class="fn">with_big_endian</a>(self) -&gt; <a class="struct" href="struct.WithOtherEndian.html" title="struct bincode::config::WithOtherEndian">WithOtherEndian</a>&lt;Self, <a class="struct" href="struct.BigEndian.html" title="struct bincode::config::BigEndian">BigEndian</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the endianness to big-endian</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_native_endian" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#152-154">Source</a><h4 class="code-header">fn <a href="#method.with_native_endian" class="fn">with_native_endian</a>(self) -&gt; <a class="struct" href="struct.WithOtherEndian.html" title="struct bincode::config::WithOtherEndian">WithOtherEndian</a>&lt;Self, <a class="struct" href="struct.NativeEndian.html" title="struct bincode::config::NativeEndian">NativeEndian</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the endianness to the the machine-native endianness</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_varint_encoding" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#157-159">Source</a><h4 class="code-header">fn <a href="#method.with_varint_encoding" class="fn">with_varint_encoding</a>(self) -&gt; <a class="struct" href="struct.WithOtherIntEncoding.html" title="struct bincode::config::WithOtherIntEncoding">WithOtherIntEncoding</a>&lt;Self, <a class="struct" href="struct.VarintEncoding.html" title="struct bincode::config::VarintEncoding">VarintEncoding</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the length encoding to varint</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_fixint_encoding" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#162-164">Source</a><h4 class="code-header">fn <a href="#method.with_fixint_encoding" class="fn">with_fixint_encoding</a>(self) -&gt; <a class="struct" href="struct.WithOtherIntEncoding.html" title="struct bincode::config::WithOtherIntEncoding">WithOtherIntEncoding</a>&lt;Self, <a class="struct" href="struct.FixintEncoding.html" title="struct bincode::config::FixintEncoding">FixintEncoding</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the length encoding to be fixed</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reject_trailing_bytes" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#167-169">Source</a><h4 class="code-header">fn <a href="#method.reject_trailing_bytes" class="fn">reject_trailing_bytes</a>(self) -&gt; <a class="struct" href="struct.WithOtherTrailing.html" title="struct bincode::config::WithOtherTrailing">WithOtherTrailing</a>&lt;Self, <a class="struct" href="struct.RejectTrailing.html" title="struct bincode::config::RejectTrailing">RejectTrailing</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the deserializer to reject trailing bytes</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.allow_trailing_bytes" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#172-174">Source</a><h4 class="code-header">fn <a href="#method.allow_trailing_bytes" class="fn">allow_trailing_bytes</a>(self) -&gt; <a class="struct" href="struct.WithOtherTrailing.html" title="struct bincode::config::WithOtherTrailing">WithOtherTrailing</a>&lt;Self, <a class="struct" href="struct.AllowTrailing.html" title="struct bincode::config::AllowTrailing">AllowTrailing</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the deserializer to allow trailing bytes</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.serialize" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#178-180">Source</a><h4 class="code-header">fn <a href="#method.serialize" class="fn">serialize</a>&lt;S: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../../serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a>&gt;(self, t: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&amp;S</a>) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.84.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Serializes a serializable object into a <code>Vec</code> of bytes using this configuration</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.serialized_size" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#184-186">Source</a><h4 class="code-header">fn <a href="#method.serialized_size" class="fn">serialized_size</a>&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../../serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a>&gt;(self, t: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u64.html">u64</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the size that an object would be if serialized using Bincode with this configuration</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.serialize_into" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#193-195">Source</a><h4 class="code-header">fn <a href="#method.serialize_into" class="fn">serialize_into</a>&lt;W: <a class="trait" href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html" title="trait std::io::Write">Write</a>, T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../../serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a>&gt;(
self,
w: W,
t: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&amp;T</a>,
) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>&gt;</h4></section></summary><div class="docblock"><p>Serializes an object directly into a <code>Writer</code> using this configuration</p>
<p>If the serialization would take more bytes than allowed by the size limit, an error
is returned and <em>no bytes</em> will be written into the <code>Writer</code></p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.deserialize" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#199-201">Source</a><h4 class="code-header">fn <a href="#method.deserialize" class="fn">deserialize</a>&lt;'a, T: <a class="trait" href="../../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a>&lt;'a&gt;&gt;(self, bytes: &amp;'a [<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;T&gt;</h4></section></summary><div class="docblock"><p>Deserializes a slice of bytes into an instance of <code>T</code> using this configuration</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.deserialize_seed" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#216-222">Source</a><h4 class="code-header">fn <a href="#method.deserialize_seed" class="fn">deserialize_seed</a>&lt;'a, T: <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a>&lt;'a&gt;&gt;(
self,
seed: T,
bytes: &amp;'a [<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>],
) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;T::<a class="associatedtype" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>&gt;</h4></section></summary><div class="docblock"><p>Deserializes a slice of bytes with state <code>seed</code> using this configuration.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.deserialize_from" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#228-230">Source</a><h4 class="code-header">fn <a href="#method.deserialize_from" class="fn">deserialize_from</a>&lt;R: <a class="trait" href="https://doc.rust-lang.org/1.84.1/std/io/trait.Read.html" title="trait std::io::Read">Read</a>, T: <a class="trait" href="../../serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>&gt;(self, reader: R) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;T&gt;</h4></section></summary><div class="docblock"><p>Deserializes an object directly from a <code>Read</code>er using this configuration</p>
<p>If this returns an <code>Error</code>, <code>reader</code> may be in an invalid state.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.deserialize_from_seed" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#236-242">Source</a><h4 class="code-header">fn <a href="#method.deserialize_from_seed" class="fn">deserialize_from_seed</a>&lt;'a, R: <a class="trait" href="https://doc.rust-lang.org/1.84.1/std/io/trait.Read.html" title="trait std::io::Read">Read</a>, T: <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a>&lt;'a&gt;&gt;(
self,
seed: T,
reader: R,
) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;T::<a class="associatedtype" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>&gt;</h4></section></summary><div class="docblock"><p>Deserializes an object directly from a <code>Read</code>er with state <code>seed</code> using this configuration</p>
<p>If this returns an <code>Error</code>, <code>reader</code> may be in an invalid state.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.deserialize_from_custom" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#250-255">Source</a><h4 class="code-header">fn <a href="#method.deserialize_from_custom" class="fn">deserialize_from_custom</a>&lt;'a, R: <a class="trait" href="../de/read/trait.BincodeRead.html" title="trait bincode::de::read::BincodeRead">BincodeRead</a>&lt;'a&gt;, T: <a class="trait" href="../../serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>&gt;(
self,
reader: R,
) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;T&gt;</h4></section></summary><div class="docblock"><p>Deserializes an object from a custom <code>BincodeRead</code>er using the default configuration.
It is highly recommended to use <code>deserialize_from</code> unless you need to implement
<code>BincodeRead</code> for performance reasons.</p>
<p>If this returns an <code>Error</code>, <code>reader</code> may be in an invalid state.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.deserialize_from_custom_seed" class="method"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#263-269">Source</a><h4 class="code-header">fn <a href="#method.deserialize_from_custom_seed" class="fn">deserialize_from_custom_seed</a>&lt;'a, R: <a class="trait" href="../de/read/trait.BincodeRead.html" title="trait bincode::de::read::BincodeRead">BincodeRead</a>&lt;'a&gt;, T: <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a>&lt;'a&gt;&gt;(
self,
seed: T,
reader: R,
) -&gt; <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a>&lt;T::<a class="associatedtype" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>&gt;</h4></section></summary><div class="docblock"><p>Deserializes an object from a custom <code>BincodeRead</code>er with state <code>seed</code> using the default
configuration. It is highly recommended to use <code>deserialize_from</code> unless you need to
implement <code>BincodeRead</code> for performance reasons.</p>
<p>If this returns an <code>Error</code>, <code>reader</code> may be in an invalid state.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.84.1/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-Options-for-T" class="impl"><a class="src rightside" href="../../src/bincode/config/mod.rs.html#272">Source</a><a href="#impl-Options-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T: InternalOptions&gt; <a class="trait" href="trait.Options.html" title="trait bincode::config::Options">Options</a> for T</h3></section></div><script src="../../trait.impl/bincode/config/trait.Options.js" async></script></section></div></main></body></html>