988 lines
131 KiB
HTML
988 lines
131 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="API documentation for the Rust `ByteOrder` trait in crate `byteorder`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, ByteOrder">
|
||
|
||
<title>byteorder::ByteOrder - Rust</title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../normalize.css">
|
||
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
|
||
<link rel="stylesheet" type="text/css" href="../main.css">
|
||
|
||
|
||
|
||
|
||
</head>
|
||
<body class="rustdoc trait">
|
||
<!--[if lte IE 8]>
|
||
<div class="warning">
|
||
This old browser is unsupported and will most likely display funky
|
||
things.
|
||
</div>
|
||
<![endif]-->
|
||
|
||
|
||
|
||
<nav class="sidebar">
|
||
|
||
<p class='location'>Trait ByteOrder</p><div class="block items"><ul><li><a href="#required-methods">Required Methods</a></li><li><a href="#provided-methods">Provided Methods</a></li><li><a href="#implementors">Implementors</a></li></ul></div><p class='location'><a href='index.html'>byteorder</a></p><script>window.sidebarCurrent = {name: 'ByteOrder', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script>
|
||
</nav>
|
||
|
||
<nav class="sub">
|
||
<form class="search-form js-only">
|
||
<div class="search-container">
|
||
<input class="search-input" name="search"
|
||
autocomplete="off"
|
||
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
||
type="search">
|
||
</div>
|
||
</form>
|
||
</nav>
|
||
|
||
<section id='main' class="content">
|
||
<h1 class='fqn'><span class='in-band'>Trait <a href='index.html'>byteorder</a>::<wbr><a class="trait" href=''>ByteOrder</a></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/byteorder/lib.rs.html#184-1609' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust trait'>pub trait ByteOrder: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a> + Sealed {
|
||
fn <a href='#tymethod.read_u16' class='fnname'>read_u16</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>;
|
||
fn <a href='#tymethod.read_u32' class='fnname'>read_u32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>;
|
||
fn <a href='#tymethod.read_u64' class='fnname'>read_u64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>;
|
||
fn <a href='#tymethod.read_uint' class='fnname'>read_uint</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>;
|
||
fn <a href='#tymethod.write_u16' class='fnname'>write_u16</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>);
|
||
fn <a href='#tymethod.write_u32' class='fnname'>write_u32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>);
|
||
fn <a href='#tymethod.write_u64' class='fnname'>write_u64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>);
|
||
fn <a href='#tymethod.write_uint' class='fnname'>write_uint</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>);
|
||
fn <a href='#tymethod.read_u16_into' class='fnname'>read_u16_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
|
||
fn <a href='#tymethod.read_u32_into' class='fnname'>read_u32_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
|
||
fn <a href='#tymethod.read_u64_into' class='fnname'>read_u64_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
|
||
fn <a href='#tymethod.write_u16_into' class='fnname'>write_u16_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
|
||
fn <a href='#tymethod.write_u32_into' class='fnname'>write_u32_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
|
||
fn <a href='#tymethod.write_u64_into' class='fnname'>write_u64_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
|
||
fn <a href='#tymethod.from_slice_u16' class='fnname'>from_slice_u16</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
|
||
fn <a href='#tymethod.from_slice_u32' class='fnname'>from_slice_u32</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
|
||
fn <a href='#tymethod.from_slice_u64' class='fnname'>from_slice_u64</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
|
||
fn <a href='#tymethod.from_slice_f32' class='fnname'>from_slice_f32</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
|
||
fn <a href='#tymethod.from_slice_f64' class='fnname'>from_slice_f64</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
|
||
|
||
fn <a href='#method.read_u24' class='fnname'>read_u24</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a> { ... }
|
||
fn <a href='#method.write_u24' class='fnname'>write_u24</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) { ... }
|
||
fn <a href='#method.read_i16' class='fnname'>read_i16</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a> { ... }
|
||
fn <a href='#method.read_i24' class='fnname'>read_i24</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a> { ... }
|
||
fn <a href='#method.read_i32' class='fnname'>read_i32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a> { ... }
|
||
fn <a href='#method.read_i64' class='fnname'>read_i64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a> { ... }
|
||
fn <a href='#method.read_int' class='fnname'>read_int</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a> { ... }
|
||
fn <a href='#method.read_f32' class='fnname'>read_f32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a> { ... }
|
||
fn <a href='#method.read_f64' class='fnname'>read_f64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a> { ... }
|
||
fn <a href='#method.write_i16' class='fnname'>write_i16</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) { ... }
|
||
fn <a href='#method.write_i24' class='fnname'>write_i24</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) { ... }
|
||
fn <a href='#method.write_i32' class='fnname'>write_i32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) { ... }
|
||
fn <a href='#method.write_i64' class='fnname'>write_i64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) { ... }
|
||
fn <a href='#method.write_int' class='fnname'>write_int</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) { ... }
|
||
fn <a href='#method.write_f32' class='fnname'>write_f32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>) { ... }
|
||
fn <a href='#method.write_f64' class='fnname'>write_f64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>) { ... }
|
||
fn <a href='#method.read_i16_into' class='fnname'>read_i16_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
fn <a href='#method.read_i32_into' class='fnname'>read_i32_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
fn <a href='#method.read_i64_into' class='fnname'>read_i64_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
unsafe fn <a href='#method.read_f32_into_unchecked' class='fnname'>read_f32_into_unchecked</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
unsafe fn <a href='#method.read_f64_into_unchecked' class='fnname'>read_f64_into_unchecked</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
fn <a href='#method.write_i16_into' class='fnname'>write_i16_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
fn <a href='#method.write_i32_into' class='fnname'>write_i32_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
fn <a href='#method.write_i64_into' class='fnname'>write_i64_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
fn <a href='#method.write_f32_into' class='fnname'>write_f32_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
fn <a href='#method.write_f64_into' class='fnname'>write_f64_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
fn <a href='#method.from_slice_i16' class='fnname'>from_slice_i16</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
fn <a href='#method.from_slice_i32' class='fnname'>from_slice_i32</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
fn <a href='#method.from_slice_i64' class='fnname'>from_slice_i64</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
|
||
}</pre><div class='docblock'><p>ByteOrder describes types that can serialize integers as bytes.</p>
|
||
|
||
<p>Note that <code>Self</code> does not appear anywhere in this trait's definition!
|
||
Therefore, in order to use it, you'll need to use syntax like
|
||
<code>T::read_u16(&[0, 1])</code> where <code>T</code> implements <code>ByteOrder</code>.</p>
|
||
|
||
<p>This crate provides two types that implement <code>ByteOrder</code>: <code>BigEndian</code>
|
||
and <code>LittleEndian</code>.
|
||
This trait is sealed and cannot be implemented for callers to avoid
|
||
breaking backwards compatibility when adding new derived traits.</p>
|
||
|
||
<h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1>
|
||
<p>Write and read <code>u32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u32</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_u32</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
|
||
<p>Write and read <code>i16</code> numbers in big endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">BigEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">2</span>];
|
||
<span class="ident">BigEndian</span>::<span class="ident">write_i16</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">50_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="op">-</span><span class="number">50_000</span>, <span class="ident">BigEndian</span>::<span class="ident">read_i16</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div>
|
||
<h2 id='required-methods'>Required Methods</h2>
|
||
<div class='methods'>
|
||
<h3 id='tymethod.read_u16' class='method'><span id='read_u16.v' class='invisible'><code>fn <a href='#tymethod.read_u16' class='fnname'>read_u16</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a></code></span></h3><div class='docblock'><p>Reads an unsigned 16 bit integer from <code>buf</code>.</p>
|
||
|
||
<h1 id='panics' class='section-header'><a href='#panics'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 2</code>.</p>
|
||
</div><h3 id='tymethod.read_u32' class='method'><span id='read_u32.v' class='invisible'><code>fn <a href='#tymethod.read_u32' class='fnname'>read_u32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code></span></h3><div class='docblock'><p>Reads an unsigned 32 bit integer from <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-1' class='section-header'><a href='#panics-1'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 4</code>.</p>
|
||
|
||
<h1 id='examples-1' class='section-header'><a href='#examples-1'>Examples</a></h1>
|
||
<p>Write and read <code>u32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u32</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_u32</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='tymethod.read_u64' class='method'><span id='read_u64.v' class='invisible'><code>fn <a href='#tymethod.read_u64' class='fnname'>read_u64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code></span></h3><div class='docblock'><p>Reads an unsigned 64 bit integer from <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-2' class='section-header'><a href='#panics-2'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 8</code>.</p>
|
||
|
||
<h1 id='examples-2' class='section-header'><a href='#examples-2'>Examples</a></h1>
|
||
<p>Write and read <code>u64</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">8</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u64</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_u64</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='tymethod.read_uint' class='method'><span id='read_uint.v' class='invisible'><code>fn <a href='#tymethod.read_uint' class='fnname'>read_uint</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code></span></h3><div class='docblock'><p>Reads an unsigned n-bytes integer from <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-3' class='section-header'><a href='#panics-3'>Panics</a></h1>
|
||
<p>Panics when <code>nbytes < 1</code> or <code>nbytes > 8</code> or
|
||
<code>buf.len() < nbytes</code></p>
|
||
|
||
<h1 id='examples-3' class='section-header'><a href='#examples-3'>Examples</a></h1>
|
||
<p>Write and read an n-byte number in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">3</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_uint</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000_000</span>, <span class="number">3</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_uint</span>(<span class="kw-2">&</span><span class="ident">buf</span>, <span class="number">3</span>));</pre>
|
||
</div><h3 id='tymethod.write_u16' class='method'><span id='write_u16.v' class='invisible'><code>fn <a href='#tymethod.write_u16' class='fnname'>write_u16</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>)</code></span></h3><div class='docblock'><p>Writes an unsigned 16 bit integer <code>n</code> to <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-4' class='section-header'><a href='#panics-4'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 2</code>.</p>
|
||
|
||
<h1 id='examples-4' class='section-header'><a href='#examples-4'>Examples</a></h1>
|
||
<p>Write and read <code>u16</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">2</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u16</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_u16</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='tymethod.write_u32' class='method'><span id='write_u32.v' class='invisible'><code>fn <a href='#tymethod.write_u32' class='fnname'>write_u32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>)</code></span></h3><div class='docblock'><p>Writes an unsigned 32 bit integer <code>n</code> to <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-5' class='section-header'><a href='#panics-5'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 4</code>.</p>
|
||
|
||
<h1 id='examples-5' class='section-header'><a href='#examples-5'>Examples</a></h1>
|
||
<p>Write and read <code>u32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u32</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_u32</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='tymethod.write_u64' class='method'><span id='write_u64.v' class='invisible'><code>fn <a href='#tymethod.write_u64' class='fnname'>write_u64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>)</code></span></h3><div class='docblock'><p>Writes an unsigned 64 bit integer <code>n</code> to <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-6' class='section-header'><a href='#panics-6'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 8</code>.</p>
|
||
|
||
<h1 id='examples-6' class='section-header'><a href='#examples-6'>Examples</a></h1>
|
||
<p>Write and read <code>u64</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">8</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u64</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_u64</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='tymethod.write_uint' class='method'><span id='write_uint.v' class='invisible'><code>fn <a href='#tymethod.write_uint' class='fnname'>write_uint</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span></h3><div class='docblock'><p>Writes an unsigned integer <code>n</code> to <code>buf</code> using only <code>nbytes</code>.</p>
|
||
|
||
<h1 id='panics-7' class='section-header'><a href='#panics-7'>Panics</a></h1>
|
||
<p>If <code>n</code> is not representable in <code>nbytes</code>, or if <code>nbytes</code> is <code>> 8</code>, then
|
||
this method panics.</p>
|
||
|
||
<h1 id='examples-7' class='section-header'><a href='#examples-7'>Examples</a></h1>
|
||
<p>Write and read an n-byte number in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">3</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_uint</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000_000</span>, <span class="number">3</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_uint</span>(<span class="kw-2">&</span><span class="ident">buf</span>, <span class="number">3</span>));</pre>
|
||
</div><h3 id='tymethod.read_u16_into' class='method'><span id='read_u16_into.v' class='invisible'><code>fn <a href='#tymethod.read_u16_into' class='fnname'>read_u16_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Reads unsigned 16 bit integers from <code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-8' class='section-header'><a href='#panics-8'>Panics</a></h1>
|
||
<p>Panics when <code>src.len() != 2*dst.len()</code>.</p>
|
||
|
||
<h1 id='examples-8' class='section-header'><a href='#examples-8'>Examples</a></h1>
|
||
<p>Write and read <code>u16</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">8</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0xf00f</span>, <span class="number">0xffee</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u16_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_u16_into</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='tymethod.read_u32_into' class='method'><span id='read_u32_into.v' class='invisible'><code>fn <a href='#tymethod.read_u32_into' class='fnname'>read_u32_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Reads unsigned 32 bit integers from <code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-9' class='section-header'><a href='#panics-9'>Panics</a></h1>
|
||
<p>Panics when <code>src.len() != 4*dst.len()</code>.</p>
|
||
|
||
<h1 id='examples-9' class='section-header'><a href='#examples-9'>Examples</a></h1>
|
||
<p>Write and read <code>u32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">16</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0xf00f</span>, <span class="number">0xffee</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u32_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_u32_into</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='tymethod.read_u64_into' class='method'><span id='read_u64_into.v' class='invisible'><code>fn <a href='#tymethod.read_u64_into' class='fnname'>read_u64_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Reads unsigned 64 bit integers from <code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-10' class='section-header'><a href='#panics-10'>Panics</a></h1>
|
||
<p>Panics when <code>src.len() != 8*dst.len()</code>.</p>
|
||
|
||
<h1 id='examples-10' class='section-header'><a href='#examples-10'>Examples</a></h1>
|
||
<p>Write and read <code>u64</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">32</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0xf00f</span>, <span class="number">0xffee</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u64_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_u64_into</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='tymethod.write_u16_into' class='method'><span id='write_u16_into.v' class='invisible'><code>fn <a href='#tymethod.write_u16_into' class='fnname'>write_u16_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Writes unsigned 16 bit integers from <code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-11' class='section-header'><a href='#panics-11'>Panics</a></h1>
|
||
<p>Panics when <code>dst.len() != 2*src.len()</code>.</p>
|
||
|
||
<h1 id='examples-11' class='section-header'><a href='#examples-11'>Examples</a></h1>
|
||
<p>Write and read <code>u16</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">8</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0xf00f</span>, <span class="number">0xffee</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u16_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_u16_into</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='tymethod.write_u32_into' class='method'><span id='write_u32_into.v' class='invisible'><code>fn <a href='#tymethod.write_u32_into' class='fnname'>write_u32_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Writes unsigned 32 bit integers from <code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-12' class='section-header'><a href='#panics-12'>Panics</a></h1>
|
||
<p>Panics when <code>dst.len() != 4*src.len()</code>.</p>
|
||
|
||
<h1 id='examples-12' class='section-header'><a href='#examples-12'>Examples</a></h1>
|
||
<p>Write and read <code>u32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">16</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0xf00f</span>, <span class="number">0xffee</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u32_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_u32_into</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='tymethod.write_u64_into' class='method'><span id='write_u64_into.v' class='invisible'><code>fn <a href='#tymethod.write_u64_into' class='fnname'>write_u64_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Writes unsigned 64 bit integers from <code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-13' class='section-header'><a href='#panics-13'>Panics</a></h1>
|
||
<p>Panics when <code>dst.len() != 8*src.len()</code>.</p>
|
||
|
||
<h1 id='examples-13' class='section-header'><a href='#examples-13'>Examples</a></h1>
|
||
<p>Write and read <code>u64</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">32</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0xf00f</span>, <span class="number">0xffee</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u64_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_u64_into</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='tymethod.from_slice_u16' class='method'><span id='from_slice_u16.v' class='invisible'><code>fn <a href='#tymethod.from_slice_u16' class='fnname'>from_slice_u16</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Converts the given slice of unsigned 16 bit integers to a particular
|
||
endianness.</p>
|
||
|
||
<p>If the endianness matches the endianness of the host platform, then
|
||
this is a no-op.</p>
|
||
|
||
<h1 id='examples-14' class='section-header'><a href='#examples-14'>Examples</a></h1>
|
||
<p>Convert the host platform's endianness to big-endian:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">BigEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers</span> <span class="op">=</span> [<span class="number">5</span>, <span class="number">65000</span>];
|
||
<span class="ident">BigEndian</span>::<span class="ident">from_slice_u16</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
|
||
<span class="kw">if</span> <span class="macro">cfg</span><span class="macro">!</span>(<span class="ident">target_endian</span> <span class="op">=</span> <span class="string">"little"</span>) {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5u16</span>.<span class="ident">swap_bytes</span>(), <span class="number">65000u16</span>.<span class="ident">swap_bytes</span>()]);
|
||
} <span class="kw">else</span> {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5</span>, <span class="number">65000</span>]);
|
||
}</pre>
|
||
</div><h3 id='tymethod.from_slice_u32' class='method'><span id='from_slice_u32.v' class='invisible'><code>fn <a href='#tymethod.from_slice_u32' class='fnname'>from_slice_u32</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Converts the given slice of unsigned 32 bit integers to a particular
|
||
endianness.</p>
|
||
|
||
<p>If the endianness matches the endianness of the host platform, then
|
||
this is a no-op.</p>
|
||
|
||
<h1 id='examples-15' class='section-header'><a href='#examples-15'>Examples</a></h1>
|
||
<p>Convert the host platform's endianness to big-endian:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">BigEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers</span> <span class="op">=</span> [<span class="number">5</span>, <span class="number">65000</span>];
|
||
<span class="ident">BigEndian</span>::<span class="ident">from_slice_u32</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
|
||
<span class="kw">if</span> <span class="macro">cfg</span><span class="macro">!</span>(<span class="ident">target_endian</span> <span class="op">=</span> <span class="string">"little"</span>) {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5u32</span>.<span class="ident">swap_bytes</span>(), <span class="number">65000u32</span>.<span class="ident">swap_bytes</span>()]);
|
||
} <span class="kw">else</span> {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5</span>, <span class="number">65000</span>]);
|
||
}</pre>
|
||
</div><h3 id='tymethod.from_slice_u64' class='method'><span id='from_slice_u64.v' class='invisible'><code>fn <a href='#tymethod.from_slice_u64' class='fnname'>from_slice_u64</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Converts the given slice of unsigned 64 bit integers to a particular
|
||
endianness.</p>
|
||
|
||
<p>If the endianness matches the endianness of the host platform, then
|
||
this is a no-op.</p>
|
||
|
||
<h1 id='examples-16' class='section-header'><a href='#examples-16'>Examples</a></h1>
|
||
<p>Convert the host platform's endianness to big-endian:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">BigEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers</span> <span class="op">=</span> [<span class="number">5</span>, <span class="number">65000</span>];
|
||
<span class="ident">BigEndian</span>::<span class="ident">from_slice_u64</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
|
||
<span class="kw">if</span> <span class="macro">cfg</span><span class="macro">!</span>(<span class="ident">target_endian</span> <span class="op">=</span> <span class="string">"little"</span>) {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5u64</span>.<span class="ident">swap_bytes</span>(), <span class="number">65000u64</span>.<span class="ident">swap_bytes</span>()]);
|
||
} <span class="kw">else</span> {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5</span>, <span class="number">65000</span>]);
|
||
}</pre>
|
||
</div><h3 id='tymethod.from_slice_f32' class='method'><span id='from_slice_f32.v' class='invisible'><code>fn <a href='#tymethod.from_slice_f32' class='fnname'>from_slice_f32</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Converts the given slice of IEEE754 single-precision (4 bytes) floating
|
||
point numbers to a particular endianness.</p>
|
||
|
||
<p>If the endianness matches the endianness of the host platform, then
|
||
this is a no-op.</p>
|
||
|
||
<p>Note that the results of this operation are guaranteed to be defined.
|
||
In particular, this method may replace signaling NaN values with
|
||
quiet NaN values.</p>
|
||
</div><h3 id='tymethod.from_slice_f64' class='method'><span id='from_slice_f64.v' class='invisible'><code>fn <a href='#tymethod.from_slice_f64' class='fnname'>from_slice_f64</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Converts the given slice of IEEE754 double-precision (8 bytes) floating
|
||
point numbers to a particular endianness.</p>
|
||
|
||
<p>If the endianness matches the endianness of the host platform, then
|
||
this is a no-op.</p>
|
||
|
||
<p>Note that the results of this operation are guaranteed to be defined.
|
||
In particular, this method may replace signaling NaN values with
|
||
quiet NaN values.</p>
|
||
</div></div>
|
||
<h2 id='provided-methods'>Provided Methods</h2>
|
||
<div class='methods'>
|
||
<h3 id='method.read_u24' class='method'><span id='read_u24.v' class='invisible'><code>fn <a href='#method.read_u24' class='fnname'>read_u24</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code></span></h3><div class='docblock'><p>Reads an unsigned 24 bit integer from <code>buf</code>, stored in u32.</p>
|
||
|
||
<h1 id='panics-14' class='section-header'><a href='#panics-14'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 3</code>.</p>
|
||
|
||
<h1 id='examples-17' class='section-header'><a href='#examples-17'>Examples</a></h1>
|
||
<p>Write and read 24 bit <code>u32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">3</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u24</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_u24</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.write_u24' class='method'><span id='write_u24.v' class='invisible'><code>fn <a href='#method.write_u24' class='fnname'>write_u24</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>)</code></span></h3><div class='docblock'><p>Writes an unsigned 24 bit integer <code>n</code> to <code>buf</code>, stored in u32.</p>
|
||
|
||
<h1 id='panics-15' class='section-header'><a href='#panics-15'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 3</code>.</p>
|
||
|
||
<h1 id='examples-18' class='section-header'><a href='#examples-18'>Examples</a></h1>
|
||
<p>Write and read 24 bit <code>u32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">3</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_u24</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_u24</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.read_i16' class='method'><span id='read_i16.v' class='invisible'><code>fn <a href='#method.read_i16' class='fnname'>read_i16</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a></code></span></h3><div class='docblock'><p>Reads a signed 16 bit integer from <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-16' class='section-header'><a href='#panics-16'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 2</code>.</p>
|
||
|
||
<h1 id='examples-19' class='section-header'><a href='#examples-19'>Examples</a></h1>
|
||
<p>Write and read <code>i16</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">2</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i16</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">1_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="op">-</span><span class="number">1_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_i16</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.read_i24' class='method'><span id='read_i24.v' class='invisible'><code>fn <a href='#method.read_i24' class='fnname'>read_i24</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></span></h3><div class='docblock'><p>Reads a signed 24 bit integer from <code>buf</code>, stored in i32.</p>
|
||
|
||
<h1 id='panics-17' class='section-header'><a href='#panics-17'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 3</code>.</p>
|
||
|
||
<h1 id='examples-20' class='section-header'><a href='#examples-20'>Examples</a></h1>
|
||
<p>Write and read 24 bit <code>i32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">3</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i24</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">1_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="op">-</span><span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_i24</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.read_i32' class='method'><span id='read_i32.v' class='invisible'><code>fn <a href='#method.read_i32' class='fnname'>read_i32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></span></h3><div class='docblock'><p>Reads a signed 32 bit integer from <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-18' class='section-header'><a href='#panics-18'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 4</code>.</p>
|
||
|
||
<h1 id='examples-21' class='section-header'><a href='#examples-21'>Examples</a></h1>
|
||
<p>Write and read <code>i32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i32</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">1_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="op">-</span><span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_i32</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.read_i64' class='method'><span id='read_i64.v' class='invisible'><code>fn <a href='#method.read_i64' class='fnname'>read_i64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code></span></h3><div class='docblock'><p>Reads a signed 64 bit integer from <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-19' class='section-header'><a href='#panics-19'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 8</code>.</p>
|
||
|
||
<h1 id='examples-22' class='section-header'><a href='#examples-22'>Examples</a></h1>
|
||
<p>Write and read <code>i64</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">8</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i64</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">1_000_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="op">-</span><span class="number">1_000_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_i64</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.read_int' class='method'><span id='read_int.v' class='invisible'><code>fn <a href='#method.read_int' class='fnname'>read_int</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code></span></h3><div class='docblock'><p>Reads a signed n-bytes integer from <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-20' class='section-header'><a href='#panics-20'>Panics</a></h1>
|
||
<p>Panics when <code>nbytes < 1</code> or <code>nbytes > 8</code> or
|
||
<code>buf.len() < nbytes</code></p>
|
||
|
||
<h1 id='examples-23' class='section-header'><a href='#examples-23'>Examples</a></h1>
|
||
<p>Write and read n-length signed numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">3</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_int</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">1_000</span>, <span class="number">3</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="op">-</span><span class="number">1_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_int</span>(<span class="kw-2">&</span><span class="ident">buf</span>, <span class="number">3</span>));</pre>
|
||
</div><h3 id='method.read_f32' class='method'><span id='read_f32.v' class='invisible'><code>fn <a href='#method.read_f32' class='fnname'>read_f32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a></code></span></h3><div class='docblock'><p>Reads a IEEE754 single-precision (4 bytes) floating point number.</p>
|
||
|
||
<p>The return value is always defined; signaling NaN's may be turned into
|
||
quiet NaN's.</p>
|
||
|
||
<h1 id='panics-21' class='section-header'><a href='#panics-21'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 4</code>.</p>
|
||
|
||
<h1 id='examples-24' class='section-header'><a href='#examples-24'>Examples</a></h1>
|
||
<p>Write and read <code>f32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="ident">e</span> <span class="op">=</span> <span class="number">2.71828</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_f32</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="ident">e</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">e</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_f32</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.read_f64' class='method'><span id='read_f64.v' class='invisible'><code>fn <a href='#method.read_f64' class='fnname'>read_f64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a></code></span></h3><div class='docblock'><p>Reads a IEEE754 double-precision (8 bytes) floating point number.</p>
|
||
|
||
<p>The return value is always defined; signaling NaN's may be turned into
|
||
quiet NaN's.</p>
|
||
|
||
<h1 id='panics-22' class='section-header'><a href='#panics-22'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 8</code>.</p>
|
||
|
||
<h1 id='examples-25' class='section-header'><a href='#examples-25'>Examples</a></h1>
|
||
<p>Write and read <code>f64</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="ident">phi</span> <span class="op">=</span> <span class="number">1.6180339887</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">8</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_f64</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="ident">phi</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">phi</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_f64</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.write_i16' class='method'><span id='write_i16.v' class='invisible'><code>fn <a href='#method.write_i16' class='fnname'>write_i16</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>)</code></span></h3><div class='docblock'><p>Writes a signed 16 bit integer <code>n</code> to <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-23' class='section-header'><a href='#panics-23'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 2</code>.</p>
|
||
|
||
<h1 id='examples-26' class='section-header'><a href='#examples-26'>Examples</a></h1>
|
||
<p>Write and read <code>i16</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">2</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i16</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">1_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="op">-</span><span class="number">1_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_i16</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.write_i24' class='method'><span id='write_i24.v' class='invisible'><code>fn <a href='#method.write_i24' class='fnname'>write_i24</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>)</code></span></h3><div class='docblock'><p>Writes a signed 24 bit integer <code>n</code> to <code>buf</code>, stored in i32.</p>
|
||
|
||
<h1 id='panics-24' class='section-header'><a href='#panics-24'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 3</code>.</p>
|
||
|
||
<h1 id='examples-27' class='section-header'><a href='#examples-27'>Examples</a></h1>
|
||
<p>Write and read 24 bit <code>i32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">3</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i24</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">1_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="op">-</span><span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_i24</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.write_i32' class='method'><span id='write_i32.v' class='invisible'><code>fn <a href='#method.write_i32' class='fnname'>write_i32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>)</code></span></h3><div class='docblock'><p>Writes a signed 32 bit integer <code>n</code> to <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-25' class='section-header'><a href='#panics-25'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 4</code>.</p>
|
||
|
||
<h1 id='examples-28' class='section-header'><a href='#examples-28'>Examples</a></h1>
|
||
<p>Write and read <code>i32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i32</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">1_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="op">-</span><span class="number">1_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_i32</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.write_i64' class='method'><span id='write_i64.v' class='invisible'><code>fn <a href='#method.write_i64' class='fnname'>write_i64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>)</code></span></h3><div class='docblock'><p>Writes a signed 64 bit integer <code>n</code> to <code>buf</code>.</p>
|
||
|
||
<h1 id='panics-26' class='section-header'><a href='#panics-26'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 8</code>.</p>
|
||
|
||
<h1 id='examples-29' class='section-header'><a href='#examples-29'>Examples</a></h1>
|
||
<p>Write and read <code>i64</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">8</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i64</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">1_000_000_000</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="op">-</span><span class="number">1_000_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_i64</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.write_int' class='method'><span id='write_int.v' class='invisible'><code>fn <a href='#method.write_int' class='fnname'>write_int</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span></h3><div class='docblock'><p>Writes a signed integer <code>n</code> to <code>buf</code> using only <code>nbytes</code>.</p>
|
||
|
||
<h1 id='panics-27' class='section-header'><a href='#panics-27'>Panics</a></h1>
|
||
<p>If <code>n</code> is not representable in <code>nbytes</code>, or if <code>nbytes</code> is <code>> 8</code>, then
|
||
this method panics.</p>
|
||
|
||
<h1 id='examples-30' class='section-header'><a href='#examples-30'>Examples</a></h1>
|
||
<p>Write and read an n-byte number in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">3</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_int</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">1_000</span>, <span class="number">3</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="op">-</span><span class="number">1_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_int</span>(<span class="kw-2">&</span><span class="ident">buf</span>, <span class="number">3</span>));</pre>
|
||
</div><h3 id='method.write_f32' class='method'><span id='write_f32.v' class='invisible'><code>fn <a href='#method.write_f32' class='fnname'>write_f32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>)</code></span></h3><div class='docblock'><p>Writes a IEEE754 single-precision (4 bytes) floating point number.</p>
|
||
|
||
<h1 id='panics-28' class='section-header'><a href='#panics-28'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 4</code>.</p>
|
||
|
||
<h1 id='examples-31' class='section-header'><a href='#examples-31'>Examples</a></h1>
|
||
<p>Write and read <code>f32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="ident">e</span> <span class="op">=</span> <span class="number">2.71828</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_f32</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="ident">e</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">e</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_f32</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.write_f64' class='method'><span id='write_f64.v' class='invisible'><code>fn <a href='#method.write_f64' class='fnname'>write_f64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>)</code></span></h3><div class='docblock'><p>Writes a IEEE754 double-precision (8 bytes) floating point number.</p>
|
||
|
||
<h1 id='panics-29' class='section-header'><a href='#panics-29'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() < 8</code>.</p>
|
||
|
||
<h1 id='examples-32' class='section-header'><a href='#examples-32'>Examples</a></h1>
|
||
<p>Write and read <code>f64</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="ident">phi</span> <span class="op">=</span> <span class="number">1.6180339887</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">8</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_f64</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="ident">phi</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">phi</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_f64</span>(<span class="kw-2">&</span><span class="ident">buf</span>));</pre>
|
||
</div><h3 id='method.read_i16_into' class='method'><span id='read_i16_into.v' class='invisible'><code>fn <a href='#method.read_i16_into' class='fnname'>read_i16_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Reads signed 16 bit integers from <code>src</code> to <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-30' class='section-header'><a href='#panics-30'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() != 2*dst.len()</code>.</p>
|
||
|
||
<h1 id='examples-33' class='section-header'><a href='#examples-33'>Examples</a></h1>
|
||
<p>Write and read <code>i16</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">8</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0xf00f</span>, <span class="number">0xffee</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i16_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_i16_into</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='method.read_i32_into' class='method'><span id='read_i32_into.v' class='invisible'><code>fn <a href='#method.read_i32_into' class='fnname'>read_i32_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Reads signed 32 bit integers from <code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-31' class='section-header'><a href='#panics-31'>Panics</a></h1>
|
||
<p>Panics when <code>src.len() != 4*dst.len()</code>.</p>
|
||
|
||
<h1 id='examples-34' class='section-header'><a href='#examples-34'>Examples</a></h1>
|
||
<p>Write and read <code>i32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">16</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0xf00f</span>, <span class="number">0xffee</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i32_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_i32_into</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='method.read_i64_into' class='method'><span id='read_i64_into.v' class='invisible'><code>fn <a href='#method.read_i64_into' class='fnname'>read_i64_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Reads signed 64 bit integers from <code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-32' class='section-header'><a href='#panics-32'>Panics</a></h1>
|
||
<p>Panics when <code>src.len() != 8*dst.len()</code>.</p>
|
||
|
||
<h1 id='examples-35' class='section-header'><a href='#examples-35'>Examples</a></h1>
|
||
<p>Write and read <code>i64</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">32</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0xf00f</span>, <span class="number">0xffee</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i64_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_i64_into</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='method.read_f32_into_unchecked' class='method'><span id='read_f32_into_unchecked.v' class='invisible'><code>unsafe fn <a href='#method.read_f32_into_unchecked' class='fnname'>read_f32_into_unchecked</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Reads IEEE754 single-precision (4 bytes) floating point numbers from
|
||
<code>src</code> into <code>dst</code>.</p>
|
||
|
||
<p>Note that this does not perform any checks on the floating point
|
||
conversion. In particular, if the <code>src</code> data encodes an undefined
|
||
floating point value for your environment, then the result may be
|
||
undefined behavior. For example, this function may produce signaling
|
||
NaN floating point values.</p>
|
||
|
||
<h1 id='panics-33' class='section-header'><a href='#panics-33'>Panics</a></h1>
|
||
<p>Panics when <code>src.len() != 4*dst.len()</code>.</p>
|
||
|
||
<h1 id='examples-36' class='section-header'><a href='#examples-36'>Examples</a></h1>
|
||
<p>Write and read <code>f32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">16</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1.0</span>, <span class="number">2.0</span>, <span class="number">31.312e311</span>, <span class="op">-</span><span class="number">11.32e91</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_f32_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0.0</span>; <span class="number">4</span>];
|
||
<span class="kw">unsafe</span> {
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_f32_into_unchecked</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
}
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='method.read_f64_into_unchecked' class='method'><span id='read_f64_into_unchecked.v' class='invisible'><code>unsafe fn <a href='#method.read_f64_into_unchecked' class='fnname'>read_f64_into_unchecked</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Reads IEEE754 single-precision (4 bytes) floating point numbers from
|
||
<code>src</code> into <code>dst</code>.</p>
|
||
|
||
<p>Note that this does not perform any checks on the floating point
|
||
conversion. In particular, if the <code>src</code> data encodes an undefined
|
||
floating point value for your environment, then the result may be
|
||
undefined behavior. For example, this function may produce signaling
|
||
NaN floating point values.</p>
|
||
|
||
<h1 id='panics-34' class='section-header'><a href='#panics-34'>Panics</a></h1>
|
||
<p>Panics when <code>src.len() != 8*dst.len()</code>.</p>
|
||
|
||
<h1 id='examples-37' class='section-header'><a href='#examples-37'>Examples</a></h1>
|
||
<p>Write and read <code>f64</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">32</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1.0</span>, <span class="number">2.0</span>, <span class="number">31.312e311</span>, <span class="op">-</span><span class="number">11.32e91</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_f64_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0.0</span>; <span class="number">4</span>];
|
||
<span class="kw">unsafe</span> {
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_f64_into_unchecked</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
}
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='method.write_i16_into' class='method'><span id='write_i16_into.v' class='invisible'><code>fn <a href='#method.write_i16_into' class='fnname'>write_i16_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Writes signed 16 bit integers from <code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-35' class='section-header'><a href='#panics-35'>Panics</a></h1>
|
||
<p>Panics when <code>buf.len() != 2*src.len()</code>.</p>
|
||
|
||
<h1 id='examples-38' class='section-header'><a href='#examples-38'>Examples</a></h1>
|
||
<p>Write and read <code>i16</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">8</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0xf00f</span>, <span class="number">0xffee</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i16_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_i16_into</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='method.write_i32_into' class='method'><span id='write_i32_into.v' class='invisible'><code>fn <a href='#method.write_i32_into' class='fnname'>write_i32_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Writes signed 32 bit integers from <code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-36' class='section-header'><a href='#panics-36'>Panics</a></h1>
|
||
<p>Panics when <code>dst.len() != 4*src.len()</code>.</p>
|
||
|
||
<h1 id='examples-39' class='section-header'><a href='#examples-39'>Examples</a></h1>
|
||
<p>Write and read <code>i32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">16</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0xf00f</span>, <span class="number">0xffee</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i32_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_i32_into</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='method.write_i64_into' class='method'><span id='write_i64_into.v' class='invisible'><code>fn <a href='#method.write_i64_into' class='fnname'>write_i64_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Writes signed 64 bit integers from <code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-37' class='section-header'><a href='#panics-37'>Panics</a></h1>
|
||
<p>Panics when <code>dst.len() != 8*src.len()</code>.</p>
|
||
|
||
<h1 id='examples-40' class='section-header'><a href='#examples-40'>Examples</a></h1>
|
||
<p>Write and read <code>i64</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">32</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0xf00f</span>, <span class="number">0xffee</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_i64_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_i64_into</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='method.write_f32_into' class='method'><span id='write_f32_into.v' class='invisible'><code>fn <a href='#method.write_f32_into' class='fnname'>write_f32_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Writes IEEE754 single-precision (4 bytes) floating point numbers from
|
||
<code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-38' class='section-header'><a href='#panics-38'>Panics</a></h1>
|
||
<p>Panics when <code>src.len() != 4*dst.len()</code>.</p>
|
||
|
||
<h1 id='examples-41' class='section-header'><a href='#examples-41'>Examples</a></h1>
|
||
<p>Write and read <code>f32</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">16</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1.0</span>, <span class="number">2.0</span>, <span class="number">31.312e311</span>, <span class="op">-</span><span class="number">11.32e91</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_f32_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0.0</span>; <span class="number">4</span>];
|
||
<span class="kw">unsafe</span> {
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_f32_into_unchecked</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
}
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='method.write_f64_into' class='method'><span id='write_f64_into.v' class='invisible'><code>fn <a href='#method.write_f64_into' class='fnname'>write_f64_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Writes IEEE754 double-precision (8 bytes) floating point numbers from
|
||
<code>src</code> into <code>dst</code>.</p>
|
||
|
||
<h1 id='panics-39' class='section-header'><a href='#panics-39'>Panics</a></h1>
|
||
<p>Panics when <code>src.len() != 8*dst.len()</code>.</p>
|
||
|
||
<h1 id='examples-42' class='section-header'><a href='#examples-42'>Examples</a></h1>
|
||
<p>Write and read <code>f64</code> numbers in little endian order:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">LittleEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">32</span>];
|
||
<span class="kw">let</span> <span class="ident">numbers_given</span> <span class="op">=</span> [<span class="number">1.0</span>, <span class="number">2.0</span>, <span class="number">31.312e311</span>, <span class="op">-</span><span class="number">11.32e91</span>];
|
||
<span class="ident">LittleEndian</span>::<span class="ident">write_f64_into</span>(<span class="kw-2">&</span><span class="ident">numbers_given</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">bytes</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers_got</span> <span class="op">=</span> [<span class="number">0.0</span>; <span class="number">4</span>];
|
||
<span class="kw">unsafe</span> {
|
||
<span class="ident">LittleEndian</span>::<span class="ident">read_f64_into_unchecked</span>(<span class="kw-2">&</span><span class="ident">bytes</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers_got</span>);
|
||
}
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers_given</span>, <span class="ident">numbers_got</span>);</pre>
|
||
</div><h3 id='method.from_slice_i16' class='method'><span id='from_slice_i16.v' class='invisible'><code>fn <a href='#method.from_slice_i16' class='fnname'>from_slice_i16</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Converts the given slice of signed 16 bit integers to a particular
|
||
endianness.</p>
|
||
|
||
<p>If the endianness matches the endianness of the host platform, then
|
||
this is a no-op.</p>
|
||
|
||
<h1 id='examples-43' class='section-header'><a href='#examples-43'>Examples</a></h1>
|
||
<p>Convert the host platform's endianness to big-endian:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">BigEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers</span> <span class="op">=</span> [<span class="number">5</span>, <span class="number">65000</span>];
|
||
<span class="ident">BigEndian</span>::<span class="ident">from_slice_i16</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
|
||
<span class="kw">if</span> <span class="macro">cfg</span><span class="macro">!</span>(<span class="ident">target_endian</span> <span class="op">=</span> <span class="string">"little"</span>) {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5i16</span>.<span class="ident">swap_bytes</span>(), <span class="number">65000i16</span>.<span class="ident">swap_bytes</span>()]);
|
||
} <span class="kw">else</span> {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5</span>, <span class="number">65000</span>]);
|
||
}</pre>
|
||
</div><h3 id='method.from_slice_i32' class='method'><span id='from_slice_i32.v' class='invisible'><code>fn <a href='#method.from_slice_i32' class='fnname'>from_slice_i32</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Converts the given slice of signed 32 bit integers to a particular
|
||
endianness.</p>
|
||
|
||
<p>If the endianness matches the endianness of the host platform, then
|
||
this is a no-op.</p>
|
||
|
||
<h1 id='examples-44' class='section-header'><a href='#examples-44'>Examples</a></h1>
|
||
<p>Convert the host platform's endianness to big-endian:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">BigEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers</span> <span class="op">=</span> [<span class="number">5</span>, <span class="number">65000</span>];
|
||
<span class="ident">BigEndian</span>::<span class="ident">from_slice_i32</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
|
||
<span class="kw">if</span> <span class="macro">cfg</span><span class="macro">!</span>(<span class="ident">target_endian</span> <span class="op">=</span> <span class="string">"little"</span>) {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5i32</span>.<span class="ident">swap_bytes</span>(), <span class="number">65000i32</span>.<span class="ident">swap_bytes</span>()]);
|
||
} <span class="kw">else</span> {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5</span>, <span class="number">65000</span>]);
|
||
}</pre>
|
||
</div><h3 id='method.from_slice_i64' class='method'><span id='from_slice_i64.v' class='invisible'><code>fn <a href='#method.from_slice_i64' class='fnname'>from_slice_i64</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></h3><div class='docblock'><p>Converts the given slice of signed 64 bit integers to a particular
|
||
endianness.</p>
|
||
|
||
<p>If the endianness matches the endianness of the host platform, then
|
||
this is a no-op.</p>
|
||
|
||
<h1 id='examples-45' class='section-header'><a href='#examples-45'>Examples</a></h1>
|
||
<p>Convert the host platform's endianness to big-endian:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">ByteOrder</span>, <span class="ident">BigEndian</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers</span> <span class="op">=</span> [<span class="number">5</span>, <span class="number">65000</span>];
|
||
<span class="ident">BigEndian</span>::<span class="ident">from_slice_i64</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
|
||
<span class="kw">if</span> <span class="macro">cfg</span><span class="macro">!</span>(<span class="ident">target_endian</span> <span class="op">=</span> <span class="string">"little"</span>) {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5i64</span>.<span class="ident">swap_bytes</span>(), <span class="number">65000i64</span>.<span class="ident">swap_bytes</span>()]);
|
||
} <span class="kw">else</span> {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5</span>, <span class="number">65000</span>]);
|
||
}</pre>
|
||
</div></div>
|
||
<h2 id='implementors'>Implementors</h2>
|
||
<ul class='item-list' id='implementors-list'>
|
||
<li><code>impl ByteOrder for <a class="enum" href="../byteorder/enum.BigEndian.html" title="enum byteorder::BigEndian">BigEndian</a></code></li>
|
||
<li><code>impl ByteOrder for <a class="enum" href="../byteorder/enum.LittleEndian.html" title="enum byteorder::LittleEndian">LittleEndian</a></code></li>
|
||
</ul><script type="text/javascript" async
|
||
src="../implementors/byteorder/trait.ByteOrder.js">
|
||
</script></section>
|
||
<section id='search' class="content hidden"></section>
|
||
|
||
<section class="footer"></section>
|
||
|
||
<aside id="help" class="hidden">
|
||
<div>
|
||
<h1 class="hidden">Help</h1>
|
||
|
||
<div class="shortcuts">
|
||
<h2>Keyboard Shortcuts</h2>
|
||
|
||
<dl>
|
||
<dt>?</dt>
|
||
<dd>Show this help dialog</dd>
|
||
<dt>S</dt>
|
||
<dd>Focus the search field</dd>
|
||
<dt>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</dt>
|
||
<dd>Go to active search result</dd>
|
||
<dt>+</dt>
|
||
<dd>Collapse/expand all sections</dd>
|
||
</dl>
|
||
</div>
|
||
|
||
<div class="infos">
|
||
<h2>Search Tricks</h2>
|
||
|
||
<p>
|
||
Prefix searches with a type followed by a colon (e.g.
|
||
<code>fn:</code>) to restrict the search to a given type.
|
||
</p>
|
||
|
||
<p>
|
||
Accepted types are: <code>fn</code>, <code>mod</code>,
|
||
<code>struct</code>, <code>enum</code>,
|
||
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
||
and <code>const</code>.
|
||
</p>
|
||
|
||
<p>
|
||
Search functions by type signature (e.g.
|
||
<code>vec -> usize</code> or <code>* -> vec</code>)
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
|
||
|
||
|
||
<script>
|
||
window.rootPath = "../";
|
||
window.currentCrate = "byteorder";
|
||
</script>
|
||
<script src="../main.js"></script>
|
||
<script defer src="../search-index.js"></script>
|
||
</body>
|
||
</html> |