edlang/gimli/trait.Endianity.html
2024-02-13 06:38:44 +00:00

59 lines
21 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

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

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A trait describing the endianity of some buffer."><title>Endianity in gimli - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="gimli" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-feafe1bb7466e4bd.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">&#9776;</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../gimli/index.html">gimli</a><span class="version">0.28.1</span></h2></div><h2 class="location"><a href="#">Endianity</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.is_big_endian">is_big_endian</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.is_little_endian">is_little_endian</a></li><li><a href="#method.read_f32">read_f32</a></li><li><a href="#method.read_f64">read_f64</a></li><li><a href="#method.read_i16">read_i16</a></li><li><a href="#method.read_i32">read_i32</a></li><li><a href="#method.read_i64">read_i64</a></li><li><a href="#method.read_u16">read_u16</a></li><li><a href="#method.read_u32">read_u32</a></li><li><a href="#method.read_u64">read_u64</a></li><li><a href="#method.read_uint">read_uint</a></li><li><a href="#method.write_u16">write_u16</a></li><li><a href="#method.write_u32">write_u32</a></li><li><a href="#method.write_u64">write_u64</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 crate gimli</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="../gimli/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">gimli</a>::<wbr><a class="trait" href="#">Endianity</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/gimli/endianity.rs.html#7-172">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub trait Endianity: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> {
<details class="toggle type-contents-toggle"><summary class="hideme"><span>Show 14 methods</span></summary> // Required method
fn <a href="#tymethod.is_big_endian" class="fn">is_big_endian</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.bool.html">bool</a>;
// Provided methods
fn <a href="#method.is_little_endian" class="fn">is_little_endian</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.bool.html">bool</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.read_u16" class="fn">read_u16</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u16.html">u16</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.read_u32" class="fn">read_u32</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u32.html">u32</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.read_u64" class="fn">read_u64</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u64.html">u64</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.read_uint" class="fn">read_uint</a>(&amp;mut self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u64.html">u64</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.read_i16" class="fn">read_i16</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.i16.html">i16</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.read_i32" class="fn">read_i32</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.i32.html">i32</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.read_i64" class="fn">read_i64</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.i64.html">i64</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.read_f32" class="fn">read_f32</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.f32.html">f32</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.read_f64" class="fn">read_f64</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.f64.html">f64</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_u16" class="fn">write_u16</a>(self, buf: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>], n: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u16.html">u16</a>) { ... }
<span class="item-spacer"></span> fn <a href="#method.write_u32" class="fn">write_u32</a>(self, buf: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>], n: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u32.html">u32</a>) { ... }
<span class="item-spacer"></span> fn <a href="#method.write_u64" class="fn">write_u64</a>(self, buf: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>], n: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u64.html">u64</a>) { ... }
</details>}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A trait describing the endianity of some buffer.</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.is_big_endian" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#9">source</a><h4 class="code-header">fn <a href="#tymethod.is_big_endian" class="fn">is_big_endian</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Return true for big endian byte order.</p>
</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.is_little_endian" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#13-15">source</a><h4 class="code-header">fn <a href="#method.is_little_endian" class="fn">is_little_endian</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Return true for little endian byte order.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.read_u16" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#23-30">source</a><h4 class="code-header">fn <a href="#method.read_u16" class="fn">read_u16</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u16.html">u16</a></h4></section></summary><div class="docblock"><p>Reads an unsigned 16 bit integer from <code>buf</code>.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>Panics when <code>buf.len() &lt; 2</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.read_u32" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#38-45">source</a><h4 class="code-header">fn <a href="#method.read_u32" class="fn">read_u32</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Reads an unsigned 32 bit integer from <code>buf</code>.</p>
<h5 id="panics-1"><a href="#panics-1">Panics</a></h5>
<p>Panics when <code>buf.len() &lt; 4</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.read_u64" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#53-60">source</a><h4 class="code-header">fn <a href="#method.read_u64" class="fn">read_u64</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Reads an unsigned 64 bit integer from <code>buf</code>.</p>
<h5 id="panics-2"><a href="#panics-2">Panics</a></h5>
<p>Panics when <code>buf.len() &lt; 8</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.read_uint" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#68-76">source</a><h4 class="code-header">fn <a href="#method.read_uint" class="fn">read_uint</a>(&amp;mut self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Read an unsigned n-bytes integer u64.</p>
<h5 id="panics-3"><a href="#panics-3">Panics</a></h5>
<p>Panics when <code>buf.len() &lt; 1</code> or <code>buf.len() &gt; 8</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.read_i16" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#84-86">source</a><h4 class="code-header">fn <a href="#method.read_i16" class="fn">read_i16</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.i16.html">i16</a></h4></section></summary><div class="docblock"><p>Reads a signed 16 bit integer from <code>buf</code>.</p>
<h5 id="panics-4"><a href="#panics-4">Panics</a></h5>
<p>Panics when <code>buf.len() &lt; 2</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.read_i32" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#94-96">source</a><h4 class="code-header">fn <a href="#method.read_i32" class="fn">read_i32</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.i32.html">i32</a></h4></section></summary><div class="docblock"><p>Reads a signed 32 bit integer from <code>buf</code>.</p>
<h5 id="panics-5"><a href="#panics-5">Panics</a></h5>
<p>Panics when <code>buf.len() &lt; 4</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.read_i64" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#104-106">source</a><h4 class="code-header">fn <a href="#method.read_i64" class="fn">read_i64</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.i64.html">i64</a></h4></section></summary><div class="docblock"><p>Reads a signed 64 bit integer from <code>buf</code>.</p>
<h5 id="panics-6"><a href="#panics-6">Panics</a></h5>
<p>Panics when <code>buf.len() &lt; 8</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.read_f32" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#114-116">source</a><h4 class="code-header">fn <a href="#method.read_f32" class="fn">read_f32</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.f32.html">f32</a></h4></section></summary><div class="docblock"><p>Reads a 32 bit floating point number from <code>buf</code>.</p>
<h5 id="panics-7"><a href="#panics-7">Panics</a></h5>
<p>Panics when <code>buf.len() &lt; 8</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.read_f64" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#124-126">source</a><h4 class="code-header">fn <a href="#method.read_f64" class="fn">read_f64</a>(self, buf: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.f64.html">f64</a></h4></section></summary><div class="docblock"><p>Reads a 32 bit floating point number from <code>buf</code>.</p>
<h5 id="panics-8"><a href="#panics-8">Panics</a></h5>
<p>Panics when <code>buf.len() &lt; 8</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.write_u16" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#134-141">source</a><h4 class="code-header">fn <a href="#method.write_u16" class="fn">write_u16</a>(self, buf: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>], n: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u16.html">u16</a>)</h4></section></summary><div class="docblock"><p>Writes an unsigned 16 bit integer <code>n</code> to <code>buf</code>.</p>
<h5 id="panics-9"><a href="#panics-9">Panics</a></h5>
<p>Panics when <code>buf.len() &lt; 2</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.write_u32" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#149-156">source</a><h4 class="code-header">fn <a href="#method.write_u32" class="fn">write_u32</a>(self, buf: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>], n: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u32.html">u32</a>)</h4></section></summary><div class="docblock"><p>Writes an unsigned 32 bit integer <code>n</code> to <code>buf</code>.</p>
<h5 id="panics-10"><a href="#panics-10">Panics</a></h5>
<p>Panics when <code>buf.len() &lt; 4</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.write_u64" class="method"><a class="src rightside" href="../src/gimli/endianity.rs.html#164-171">source</a><h4 class="code-header">fn <a href="#method.write_u64" class="fn">write_u64</a>(self, buf: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u8.html">u8</a>], n: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/core/primitive.u64.html">u64</a>)</h4></section></summary><div class="docblock"><p>Writes an unsigned 64 bit integer <code>n</code> to <code>buf</code>.</p>
<h5 id="panics-11"><a href="#panics-11">Panics</a></h5>
<p>Panics when <code>buf.len() &lt; 8</code>.</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.76.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"><section id="impl-Endianity-for-RunTimeEndian" class="impl"><a class="src rightside" href="../src/gimli/endianity.rs.html#197-202">source</a><a href="#impl-Endianity-for-RunTimeEndian" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Endianity.html" title="trait gimli::Endianity">Endianity</a> for <a class="enum" href="enum.RunTimeEndian.html" title="enum gimli::RunTimeEndian">RunTimeEndian</a></h3></section><section id="impl-Endianity-for-BigEndian" class="impl"><a class="src rightside" href="../src/gimli/endianity.rs.html#233-238">source</a><a href="#impl-Endianity-for-BigEndian" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Endianity.html" title="trait gimli::Endianity">Endianity</a> for <a class="struct" href="struct.BigEndian.html" title="struct gimli::BigEndian">BigEndian</a></h3></section><section id="impl-Endianity-for-LittleEndian" class="impl"><a class="src rightside" href="../src/gimli/endianity.rs.html#215-220">source</a><a href="#impl-Endianity-for-LittleEndian" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Endianity.html" title="trait gimli::Endianity">Endianity</a> for <a class="struct" href="struct.LittleEndian.html" title="struct gimli::LittleEndian">LittleEndian</a></h3></section></div><script src="../trait.impl/gimli/endianity/trait.Endianity.js" async></script></section></div></main></body></html>