65 lines
36 KiB
HTML
65 lines
36 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."><meta name="keywords" content="rust, rustlang, rust-lang, Options"><title>Options in bincode::config - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script src="../../crates.js"></script><script defer src="../../main.js"></script>
|
||
<noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.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="sidebar"><div class="sidebar-menu" role="button">☰</div><a class="sidebar-logo" href="../../bincode/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.png" alt="logo"></div>
|
||
</a><h2 class="location">Trait Options</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#provided-methods">Provided Methods</a></h3><div class="sidebar-links"><a href="#method.allow_trailing_bytes">allow_trailing_bytes</a><a href="#method.deserialize">deserialize</a><a href="#method.deserialize_from">deserialize_from</a><a href="#method.deserialize_from_custom">deserialize_from_custom</a><a href="#method.deserialize_from_custom_seed">deserialize_from_custom_seed</a><a href="#method.deserialize_from_seed">deserialize_from_seed</a><a href="#method.deserialize_seed">deserialize_seed</a><a href="#method.reject_trailing_bytes">reject_trailing_bytes</a><a href="#method.serialize">serialize</a><a href="#method.serialize_into">serialize_into</a><a href="#method.serialized_size">serialized_size</a><a href="#method.with_big_endian">with_big_endian</a><a href="#method.with_fixint_encoding">with_fixint_encoding</a><a href="#method.with_limit">with_limit</a><a href="#method.with_little_endian">with_little_endian</a><a href="#method.with_native_endian">with_native_endian</a><a href="#method.with_no_limit">with_no_limit</a><a href="#method.with_varint_encoding">with_varint_encoding</a></div><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div><h2 class="location">Other items in<br><a href="../index.html">bincode</a>::<wbr><a href="index.html">config</a></h2><div id="sidebar-vars" data-name="Options" data-ty="trait" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../bincode/index.html"><img class="rust-logo" src="../../rust-logo.png" alt="logo"></a><nav class="sub"><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../wheel.svg"></a></div></form></nav></div><section id="main-content" class="content"><h1 class="fqn"><span class="in-band">Trait <a href="../index.html">bincode</a>::<wbr><a href="index.html">config</a>::<wbr><a class="trait" href="#">Options</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/bincode/config/mod.rs.html#128-270" title="goto source code">[src]</a></span></h1><div class="docblock item-decl"><pre class="rust trait"><code>pub trait Options: InternalOptions + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
|
||
<details class="rustdoc-toggle type-contents-toggle"><summary class="hideme"><span>Show 18 methods</span></summary> fn <a href="#method.with_no_limit" class="fnname">with_no_limit</a>(self) -> <a class="struct" href="struct.WithOtherLimit.html" title="struct bincode::config::WithOtherLimit">WithOtherLimit</a><Self, <a class="struct" href="struct.Infinite.html" title="struct bincode::config::Infinite">Infinite</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.with_limit" class="fnname">with_limit</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u64.html">u64</a>) -> <a class="struct" href="struct.WithOtherLimit.html" title="struct bincode::config::WithOtherLimit">WithOtherLimit</a><Self, <a class="struct" href="struct.Bounded.html" title="struct bincode::config::Bounded">Bounded</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.with_little_endian" class="fnname">with_little_endian</a>(self) -> <a class="struct" href="struct.WithOtherEndian.html" title="struct bincode::config::WithOtherEndian">WithOtherEndian</a><Self, <a class="struct" href="struct.LittleEndian.html" title="struct bincode::config::LittleEndian">LittleEndian</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.with_big_endian" class="fnname">with_big_endian</a>(self) -> <a class="struct" href="struct.WithOtherEndian.html" title="struct bincode::config::WithOtherEndian">WithOtherEndian</a><Self, <a class="struct" href="struct.BigEndian.html" title="struct bincode::config::BigEndian">BigEndian</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.with_native_endian" class="fnname">with_native_endian</a>(self) -> <a class="struct" href="struct.WithOtherEndian.html" title="struct bincode::config::WithOtherEndian">WithOtherEndian</a><Self, <a class="struct" href="struct.NativeEndian.html" title="struct bincode::config::NativeEndian">NativeEndian</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.with_varint_encoding" class="fnname">with_varint_encoding</a>(self) -> <a class="struct" href="struct.WithOtherIntEncoding.html" title="struct bincode::config::WithOtherIntEncoding">WithOtherIntEncoding</a><Self, <a class="struct" href="struct.VarintEncoding.html" title="struct bincode::config::VarintEncoding">VarintEncoding</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.with_fixint_encoding" class="fnname">with_fixint_encoding</a>(self) -> <a class="struct" href="struct.WithOtherIntEncoding.html" title="struct bincode::config::WithOtherIntEncoding">WithOtherIntEncoding</a><Self, <a class="struct" href="struct.FixintEncoding.html" title="struct bincode::config::FixintEncoding">FixintEncoding</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.reject_trailing_bytes" class="fnname">reject_trailing_bytes</a>(self) -> <a class="struct" href="struct.WithOtherTrailing.html" title="struct bincode::config::WithOtherTrailing">WithOtherTrailing</a><Self, <a class="struct" href="struct.RejectTrailing.html" title="struct bincode::config::RejectTrailing">RejectTrailing</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.allow_trailing_bytes" class="fnname">allow_trailing_bytes</a>(self) -> <a class="struct" href="struct.WithOtherTrailing.html" title="struct bincode::config::WithOtherTrailing">WithOtherTrailing</a><Self, <a class="struct" href="struct.AllowTrailing.html" title="struct bincode::config::AllowTrailing">AllowTrailing</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.serialize" class="fnname">serialize</a><S: ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/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>>(self, t: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&</a>S) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a>>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.serialized_size" class="fnname">serialized_size</a><T: ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/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>>(self, t: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&</a>T) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u64.html">u64</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.serialize_into" class="fnname">serialize_into</a><W: <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a>, T: ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/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>>(<br> self, <br> w: W, <br> t: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&</a>T<br> ) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.deserialize" class="fnname">deserialize</a><'a, T: <a class="trait" href="../../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a><'a>>(self, bytes: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&'a [</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><T> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.deserialize_seed" class="fnname">deserialize_seed</a><'a, T: <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'a>>(<br> self, <br> seed: T, <br> bytes: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&'a [</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a><br> ) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><T::<a class="associatedtype" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.deserialize_from" class="fnname">deserialize_from</a><R: <a class="trait" href="https://doc.rust-lang.org/1.59.0/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>>(<br> self, <br> reader: R<br> ) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><T> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.deserialize_from_seed" class="fnname">deserialize_from_seed</a><'a, R: <a class="trait" href="https://doc.rust-lang.org/1.59.0/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><'a>>(<br> self, <br> seed: T, <br> reader: R<br> ) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><T::<a class="associatedtype" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.deserialize_from_custom" class="fnname">deserialize_from_custom</a><'a, R: <a class="trait" href="../de/read/trait.BincodeRead.html" title="trait bincode::de::read::BincodeRead">BincodeRead</a><'a>, T: <a class="trait" href="../../serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>>(<br> self, <br> reader: R<br> ) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><T> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.deserialize_from_custom_seed" class="fnname">deserialize_from_custom_seed</a><'a, R: <a class="trait" href="../de/read/trait.BincodeRead.html" title="trait bincode::de::read::BincodeRead">BincodeRead</a><'a>, T: <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'a>>(<br> self, <br> seed: T, <br> reader: R<br> ) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><T::<a class="associatedtype" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>> { ... }
|
||
</details>}</code></pre></div><details class="rustdoc-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" class="section-header"><a href="#options">Options</a></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" class="section-header"><a href="#byte-limit-details">Byte Limit Details</a></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="small-section-header">Provided methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="method.with_no_limit" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#131-133" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.with_no_limit" class="fnname">with_no_limit</a>(self) -> <a class="struct" href="struct.WithOtherLimit.html" title="struct bincode::config::WithOtherLimit">WithOtherLimit</a><Self, <a class="struct" href="struct.Infinite.html" title="struct bincode::config::Infinite">Infinite</a>></h4></div></summary><div class="docblock"><p>Sets the byte limit to be unlimited.
|
||
This is the default.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.with_limit" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#136-138" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.with_limit" class="fnname">with_limit</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u64.html">u64</a>) -> <a class="struct" href="struct.WithOtherLimit.html" title="struct bincode::config::WithOtherLimit">WithOtherLimit</a><Self, <a class="struct" href="struct.Bounded.html" title="struct bincode::config::Bounded">Bounded</a>></h4></div></summary><div class="docblock"><p>Sets the byte limit to <code>limit</code>.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.with_little_endian" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#142-144" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.with_little_endian" class="fnname">with_little_endian</a>(self) -> <a class="struct" href="struct.WithOtherEndian.html" title="struct bincode::config::WithOtherEndian">WithOtherEndian</a><Self, <a class="struct" href="struct.LittleEndian.html" title="struct bincode::config::LittleEndian">LittleEndian</a>></h4></div></summary><div class="docblock"><p>Sets the endianness to little-endian
|
||
This is the default.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.with_big_endian" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#147-149" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.with_big_endian" class="fnname">with_big_endian</a>(self) -> <a class="struct" href="struct.WithOtherEndian.html" title="struct bincode::config::WithOtherEndian">WithOtherEndian</a><Self, <a class="struct" href="struct.BigEndian.html" title="struct bincode::config::BigEndian">BigEndian</a>></h4></div></summary><div class="docblock"><p>Sets the endianness to big-endian</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.with_native_endian" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#152-154" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.with_native_endian" class="fnname">with_native_endian</a>(self) -> <a class="struct" href="struct.WithOtherEndian.html" title="struct bincode::config::WithOtherEndian">WithOtherEndian</a><Self, <a class="struct" href="struct.NativeEndian.html" title="struct bincode::config::NativeEndian">NativeEndian</a>></h4></div></summary><div class="docblock"><p>Sets the endianness to the the machine-native endianness</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.with_varint_encoding" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#157-159" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.with_varint_encoding" class="fnname">with_varint_encoding</a>(self) -> <a class="struct" href="struct.WithOtherIntEncoding.html" title="struct bincode::config::WithOtherIntEncoding">WithOtherIntEncoding</a><Self, <a class="struct" href="struct.VarintEncoding.html" title="struct bincode::config::VarintEncoding">VarintEncoding</a>></h4></div></summary><div class="docblock"><p>Sets the length encoding to varint</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.with_fixint_encoding" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#162-164" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.with_fixint_encoding" class="fnname">with_fixint_encoding</a>(self) -> <a class="struct" href="struct.WithOtherIntEncoding.html" title="struct bincode::config::WithOtherIntEncoding">WithOtherIntEncoding</a><Self, <a class="struct" href="struct.FixintEncoding.html" title="struct bincode::config::FixintEncoding">FixintEncoding</a>></h4></div></summary><div class="docblock"><p>Sets the length encoding to be fixed</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.reject_trailing_bytes" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#167-169" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.reject_trailing_bytes" class="fnname">reject_trailing_bytes</a>(self) -> <a class="struct" href="struct.WithOtherTrailing.html" title="struct bincode::config::WithOtherTrailing">WithOtherTrailing</a><Self, <a class="struct" href="struct.RejectTrailing.html" title="struct bincode::config::RejectTrailing">RejectTrailing</a>></h4></div></summary><div class="docblock"><p>Sets the deserializer to reject trailing bytes</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.allow_trailing_bytes" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#172-174" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.allow_trailing_bytes" class="fnname">allow_trailing_bytes</a>(self) -> <a class="struct" href="struct.WithOtherTrailing.html" title="struct bincode::config::WithOtherTrailing">WithOtherTrailing</a><Self, <a class="struct" href="struct.AllowTrailing.html" title="struct bincode::config::AllowTrailing">AllowTrailing</a>></h4></div></summary><div class="docblock"><p>Sets the deserializer to allow trailing bytes</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.serialize" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#178-180" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.serialize" class="fnname">serialize</a><S: ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/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>>(self, t: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&</a>S) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a>>></h4></div></summary><div class="docblock"><p>Serializes a serializable object into a <code>Vec</code> of bytes using this configuration</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.serialized_size" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#184-186" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.serialized_size" class="fnname">serialized_size</a><T: ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/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>>(self, t: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&</a>T) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u64.html">u64</a>></h4></div></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="rustdoc-toggle" open><summary><div id="method.serialize_into" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#193-195" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.serialize_into" class="fnname">serialize_into</a><W: <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a>, T: ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/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>>(<br> self, <br> w: W, <br> t: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&</a>T<br>) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></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="rustdoc-toggle" open><summary><div id="method.deserialize" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#199-201" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.deserialize" class="fnname">deserialize</a><'a, T: <a class="trait" href="../../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a><'a>>(self, bytes: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&'a [</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><T></h4></div></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="rustdoc-toggle" open><summary><div id="method.deserialize_seed" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#216-222" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.deserialize_seed" class="fnname">deserialize_seed</a><'a, T: <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'a>>(<br> self, <br> seed: T, <br> bytes: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&'a [</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a><br>) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><T::<a class="associatedtype" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>></h4></div></summary><div class="docblock"><p>Deserializes a slice of bytes with state <code>seed</code> using this configuration.</p>
|
||
</div></details><details class="rustdoc-toggle" open><summary><div id="method.deserialize_from" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#228-230" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.deserialize_from" class="fnname">deserialize_from</a><R: <a class="trait" href="https://doc.rust-lang.org/1.59.0/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>>(self, reader: R) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><T></h4></div></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="rustdoc-toggle" open><summary><div id="method.deserialize_from_seed" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#236-242" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.deserialize_from_seed" class="fnname">deserialize_from_seed</a><'a, R: <a class="trait" href="https://doc.rust-lang.org/1.59.0/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><'a>>(<br> self, <br> seed: T, <br> reader: R<br>) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><T::<a class="associatedtype" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>></h4></div></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="rustdoc-toggle" open><summary><div id="method.deserialize_from_custom" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#250-255" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.deserialize_from_custom" class="fnname">deserialize_from_custom</a><'a, R: <a class="trait" href="../de/read/trait.BincodeRead.html" title="trait bincode::de::read::BincodeRead">BincodeRead</a><'a>, T: <a class="trait" href="../../serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>>(<br> self, <br> reader: R<br>) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><T></h4></div></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="rustdoc-toggle" open><summary><div id="method.deserialize_from_custom_seed" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#263-269" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#method.deserialize_from_custom_seed" class="fnname">deserialize_from_custom_seed</a><'a, R: <a class="trait" href="../de/read/trait.BincodeRead.html" title="trait bincode::de::read::BincodeRead">BincodeRead</a><'a>, T: <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'a>>(<br> self, <br> seed: T, <br> reader: R<br>) -> <a class="type" href="../type.Result.html" title="type bincode::Result">Result</a><T::<a class="associatedtype" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>></h4></div></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="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><div id="impl-Options" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/bincode/config/mod.rs.html#272" title="goto source code">[src]</a></div><a href="#impl-Options" class="anchor"></a><h3 class="code-header in-band">impl<T: InternalOptions> <a class="trait" href="trait.Options.html" title="trait bincode::config::Options">Options</a> for T</h3></div></div><script type="text/javascript" src="../../implementors/bincode/config/trait.Options.js" async></script></section><section id="search" class="content hidden"></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="bincode" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.59.0 (9d1b2106e 2022-02-23)" ></div>
|
||
</body></html> |