mirror of
https://github.com/NotAShelf/mpvrc.git
synced 2026-04-17 16:29:50 +00:00
33 lines
No EOL
11 KiB
HTML
33 lines
No EOL
11 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="An optional Read trait for advanced Bincode usage."><title>BincodeRead in bincode::de::read - 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="#">Bincode<wbr>Read</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.forward_read_bytes" title="forward_read_bytes">forward_read_bytes</a></li><li><a href="#tymethod.forward_read_str" title="forward_read_str">forward_read_str</a></li><li><a href="#tymethod.get_byte_buffer" title="get_byte_buffer">get_byte_buffer</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>de::<wbr>read</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">de</a>::<wbr><a href="index.html">read</a></span><h1>Trait <span class="trait">BincodeRead</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/de/read.rs.html#13-27">Source</a> </span></div><pre class="rust item-decl"><code>pub trait BincodeRead<'storage>: <a class="trait" href="https://doc.rust-lang.org/1.84.1/std/io/trait.Read.html" title="trait std::io::Read">Read</a> {
|
|
// Required methods
|
|
fn <a href="#tymethod.forward_read_str" class="fn">forward_read_str</a><V>(
|
|
&mut self,
|
|
length: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>,
|
|
visitor: V,
|
|
) -> <a class="type" href="../../type.Result.html" title="type bincode::Result">Result</a><V::<a class="associatedtype" href="../../../serde/de/trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>>
|
|
<span class="where">where V: <a class="trait" href="../../../serde/de/trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a><'storage></span>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.get_byte_buffer" class="fn">get_byte_buffer</a>(&mut self, length: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>) -> <a class="type" href="../../type.Result.html" title="type bincode::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.84.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>>>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.forward_read_bytes" class="fn">forward_read_bytes</a><V>(
|
|
&mut self,
|
|
length: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>,
|
|
visitor: V,
|
|
) -> <a class="type" href="../../type.Result.html" title="type bincode::Result">Result</a><V::<a class="associatedtype" href="../../../serde/de/trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>>
|
|
<span class="where">where V: <a class="trait" href="../../../serde/de/trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a><'storage></span>;
|
|
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An optional Read trait for advanced Bincode usage.</p>
|
|
<p>It is highly recommended to use bincode with <code>io::Read</code> or <code>&[u8]</code> before
|
|
implementing a custom <code>BincodeRead</code>.</p>
|
|
<p>The forward_read_* methods are necessary because some byte sources want
|
|
to pass a long-lived borrow to the visitor and others want to pass a
|
|
transient slice.</p>
|
|
</div></details><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.forward_read_str" class="method"><a class="src rightside" href="../../../src/bincode/de/read.rs.html#16-18">Source</a><h4 class="code-header">fn <a href="#tymethod.forward_read_str" class="fn">forward_read_str</a><V>(&mut self, length: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>, visitor: V) -> <a class="type" href="../../type.Result.html" title="type bincode::Result">Result</a><V::<a class="associatedtype" href="../../../serde/de/trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>><div class="where">where
|
|
V: <a class="trait" href="../../../serde/de/trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a><'storage>,</div></h4></section></summary><div class="docblock"><p>Check that the next <code>length</code> bytes are a valid string and pass
|
|
it on to the serde reader.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.get_byte_buffer" class="method"><a class="src rightside" href="../../../src/bincode/de/read.rs.html#21">Source</a><h4 class="code-header">fn <a href="#tymethod.get_byte_buffer" class="fn">get_byte_buffer</a>(&mut self, length: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>) -> <a class="type" href="../../type.Result.html" title="type bincode::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.84.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>>></h4></section></summary><div class="docblock"><p>Transfer ownership of the next <code>length</code> bytes to the caller.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.forward_read_bytes" class="method"><a class="src rightside" href="../../../src/bincode/de/read.rs.html#24-26">Source</a><h4 class="code-header">fn <a href="#tymethod.forward_read_bytes" class="fn">forward_read_bytes</a><V>(
|
|
&mut self,
|
|
length: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>,
|
|
visitor: V,
|
|
) -> <a class="type" href="../../type.Result.html" title="type bincode::Result">Result</a><V::<a class="associatedtype" href="../../../serde/de/trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>><div class="where">where
|
|
V: <a class="trait" href="../../../serde/de/trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a><'storage>,</div></h4></section></summary><div class="docblock"><p>Pass a slice of the next <code>length</code> bytes on to the serde reader.</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-BincodeRead%3C'a%3E-for-IoReader%3CR%3E" class="impl"><a class="src rightside" href="../../../src/bincode/de/read.rs.html#152-182">Source</a><a href="#impl-BincodeRead%3C'a%3E-for-IoReader%3CR%3E" class="anchor">§</a><h3 class="code-header">impl<'a, R> <a class="trait" href="trait.BincodeRead.html" title="trait bincode::de::read::BincodeRead">BincodeRead</a><'a> for <a class="struct" href="struct.IoReader.html" title="struct bincode::de::read::IoReader">IoReader</a><R><div class="where">where
|
|
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>,</div></h3></section><section id="impl-BincodeRead%3C'storage%3E-for-SliceReader%3C'storage%3E" class="impl"><a class="src rightside" href="../../../src/bincode/de/read.rs.html#111-137">Source</a><a href="#impl-BincodeRead%3C'storage%3E-for-SliceReader%3C'storage%3E" class="anchor">§</a><h3 class="code-header">impl<'storage> <a class="trait" href="trait.BincodeRead.html" title="trait bincode::de::read::BincodeRead">BincodeRead</a><'storage> for <a class="struct" href="struct.SliceReader.html" title="struct bincode::de::read::SliceReader">SliceReader</a><'storage></h3></section></div><script src="../../../trait.impl/bincode/de/read/trait.BincodeRead.js" async></script></section></div></main></body></html> |