You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Trac3r-rust/doc/byteorder/trait.ByteOrder.html

1016 lines
221 KiB

5 years ago
<!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" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></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"><div class="sidebar-menu">&#9776;</div><a href='../byteorder/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Trait ByteOrder</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.from_slice_f32">from_slice_f32</a><a href="#tymethod.from_slice_f64">from_slice_f64</a><a href="#tymethod.from_slice_u128">from_slice_u128</a><a href="#tymethod.from_slice_u16">from_slice_u16</a><a href="#tymethod.from_slice_u32">from_slice_u32</a><a href="#tymethod.from_slice_u64">from_slice_u64</a><a href="#tymethod.read_u128">read_u128</a><a href="#tymethod.read_u128_into">read_u128_into</a><a href="#tymethod.read_u16">read_u16</a><a href="#tymethod.read_u16_into">read_u16_into</a><a href="#tymethod.read_u32">read_u32</a><a href="#tymethod.read_u32_into">read_u32_into</a><a href="#tymethod.read_u64">read_u64</a><a href="#tymethod.read_u64_into">read_u64_into</a><a href="#tymethod.read_uint">read_uint</a><a href="#tymethod.read_uint128">read_uint128</a><a href="#tymethod.write_u128">write_u128</a><a href="#tymethod.write_u128_into">write_u128_into</a><a href="#tymethod.write_u16">write_u16</a><a href="#tymethod.write_u16_into">write_u16_into</a><a href="#tymethod.write_u32">write_u32</a><a href="#tymethod.write_u32_into">write_u32_into</a><a href="#tymethod.write_u64">write_u64</a><a href="#tymethod.write_u64_into">write_u64_into</a><a href="#tymethod.write_uint">write_uint</a><a href="#tymethod.write_uint128">write_uint128</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.from_slice_i128">from_slice_i128</a><a href="#method.from_slice_i16">from_slice_i16</a><a href="#method.from_slice_i32">from_slice_i32</a><a href="#method.from_slice_i64">from_slice_i64</a><a href="#method.read_f32">read_f32</a><a href="#method.read_f32_into">read_f32_into</a><a href="#method.read_f32_into_unchecked">read_f32_into_unchecked</a><a href="#method.read_f64">read_f64</a><a href="#method.read_f64_into">read_f64_into</a><a href="#method.read_f64_into_unchecked">read_f64_into_unchecked</a><a href="#method.read_i128">read_i128</a><a href="#method.read_i128_into">read_i128_into</a><a href="#method.read_i16">read_i16</a><a href="#method.read_i16_into">read_i16_into</a><a href="#method.read_i24">read_i24</a><a href="#method.read_i32">read_i32</a><a href="#method.read_i32_into">read_i32_into</a><a href="#method.read_i48">read_i48</a><a href="#method.read_i64">read_i64</a><a href="#method.read_i64_into">read_i64_into</a><a href="#method.read_int">read_int</a><a href="#method.read_int128">read_int128</a><a href="#method.read_u24">read_u24</a><a href="#method.read_u48">read_u48</a><a href="#method.write_f32">write_f32</a><a href="#method.write_f32_into">write_f32_into</a><a href="#method.write_f64">write_f64</a><a href="#method.write_f64_into">write_f64_int
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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>;
<div class='item-spacer'></div> 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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>;
<div class='item-spacer'></div> 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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>;
<div class='item-spacer'></div> fn <a href='#tymethod.read_u128' class='fnname'>read_u128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a>;
<div class='item-spacer'></div> 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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>;
<div class='item-spacer'></div> fn <a href='#tymethod.read_uint128' class='fnname'>read_uint128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a>;
<div class='item-spacer'></div> 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">&amp;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>);
<div class='item-spacer'></div> 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">&amp;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>);
<div class='item-spacer'></div> 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">&amp;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>);
<div class='item-spacer'></div> fn <a href='#tymethod.write_u128' class='fnname'>write_u128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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.u128.html">u128</a>);
<div class='item-spacer'></div> 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">&amp;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>);
<div class='item-spacer'></div> fn <a href='#tymethod.write_uint128' class='fnname'>write_uint128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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.u128.html">u128</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>);
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>);
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>);
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>);
<div class='item-spacer'></div> fn <a href='#tymethod.read_u128_into' class='fnname'>read_u128_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>);
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>);
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>);
<div class='item-spacer'></div> fn <a href='#tymethod.write_u128_into' class='fnname'>write_u128_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</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">&amp;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>);
<div class='item-spacer'></div> 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">&amp;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>);
<div class='item-spacer'></div> 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">&amp;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>);
<div class='item-spacer'></div> 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">&amp;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>);
<div class='item-spacer'></div> fn <a href='#tymethod.from_slice_u128' class='fnname'>from_slice_u128</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
<div class='item-spacer'></div> 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">&amp;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>);
<div class='item-spacer'></div> 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">&amp;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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a> { ... }
<div class='item-spacer'></div> fn <a href='#method.read_u48' class='fnname'>read_u48</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a> { ... }
<div class='item-spacer'></div> 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">&amp;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>) { ... }
<div class='item-spacer'></div> fn <a href='#method.write_u48' class='fnname'>write_u48</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a> { ... }
<div class='item-spacer'></div> 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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a> { ... }
<div class='item-spacer'></div> 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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a> { ... }
<div class='item-spacer'></div> fn <a href='#method.read_i48' class='fnname'>read_i48</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a> { ... }
<div class='item-spacer'></div> 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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a> { ... }
<div class='item-spacer'></div> fn <a href='#method.read_i128' class='fnname'>read_i128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a> { ... }
<div class='item-spacer'></div> 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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a> { ... }
<div class='item-spacer'></div> fn <a href='#method.read_int128' class='fnname'>read_int128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a> { ... }
<div class='item-spacer'></div> 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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a> { ... }
<div class='item-spacer'></div> 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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a> { ... }
<div class='item-spacer'></div> 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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;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>) { ... }
<div class='item-spacer'></div> fn <a href='#method.write_i48' class='fnname'>write_i48</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;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>) { ... }
<div class='item-spacer'></div> fn <a href='#method.write_i128' class='fnname'>write_i128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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.i128.html">i128</a>) { ... }
<div class='item-spacer'></div> 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">&amp;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>) { ... }
<div class='item-spacer'></div> fn <a href='#method.write_int128' class='fnname'>write_int128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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.i128.html">i128</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) { ... }
<div class='item-spacer'></div> 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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>) { ... }
<div class='item-spacer'></div> fn <a href='#method.read_i128_into' class='fnname'>read_i128_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
<div class='item-spacer'></div> fn <a href='#method.read_f32_into' class='fnname'>read_f32_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>) { ... }
<div class='item-spacer'></div> fn <a href='#method.read_f64_into' class='fnname'>read_f64_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>) { ... }
<div class='item-spacer'></div> fn <a href='#method.write_i128_into' class='fnname'>write_i128_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>) { ... }
<div class='item-spacer'></div> 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">&amp;[</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">&amp;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>) { ... }
<div class='item-spacer'></div> fn <a href='#method.from_slice_i16' class='fnname'>from_slice_i16</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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>) { ... }
<div class='item-spacer'></div> fn <a href='#method.from_slice_i32' class='fnname'>from_slice_i32</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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>) { ... }
<div class='item-spacer'></div> fn <a href='#method.from_slice_i64' class='fnname'>from_slice_i64</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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>) { ... }
<div class='item-spacer'></div> fn <a href='#method.from_slice_i128' class='fnname'>from_slice_i128</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) { ... }
}</pre></div><div class='docblock'><p><code>ByteOrder</code> 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(&amp;[0, 1])</code> where <code>T</code> implements <code>ByteOrder</code>.</p>
<p>This crate provides two types that implement <code>ByteOrder</code>: <a href="enum.BigEndian.html"><code>BigEndian</code></a>
and <a href="enum.LittleEndian.html"><code>LittleEndian</code></a>.
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>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
<p>Write and read <code>i16</code> numbers in big endian order:</p>
<div class="example-wrap"><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">&amp;</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">5_000</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="op">-</span><span class="number">5_000</span>, <span class="ident">BigEndian</span>::<span class="ident">read_i16</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>));</pre></div>
</div>
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.read_u16' class='method'><code id='read_u16.v'>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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a></code></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() &lt; 2</code>.</p>
</div><h3 id='tymethod.read_u32' class='method'><code id='read_u32.v'>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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code></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() &lt; 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>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='tymethod.read_u64' class='method'><code id='read_u64.v'>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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code></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() &lt; 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>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='tymethod.read_u128' class='method'><code id='read_u128.v'>fn <a href='#tymethod.read_u128' class='fnname'>read_u128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a></code></h3><div class='docblock'><p>Reads an unsigned 128 bit integer from <code>buf</code>.</p>
<h1 id="panics-3" class="section-header"><a href="#panics-3">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 16</code>.</p>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<p>Write and read <code>u128</code> numbers in little endian order:</p>
<div class="example-wrap"><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">16</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_u128</span>(<span class="kw-2">&amp;</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_u128</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='tymethod.read_uint' class='method'><code id='read_uint.v'>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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code></h3><div class='docblock'><p>Reads an unsigned n-bytes integer from <code>buf</code>.</p>
<h1 id="panics-4" class="section-header"><a href="#panics-4">Panics</a></h1>
<p>Panics when <code>nbytes &lt; 1</code> or <code>nbytes &gt; 8</code> or
<code>buf.len() &lt; nbytes</code></p>
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
<p>Write and read an n-byte number in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>, <span class="number">3</span>));</pre></div>
</div><h3 id='tymethod.read_uint128' class='method'><code id='read_uint128.v'>fn <a href='#tymethod.read_uint128' class='fnname'>read_uint128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a></code></h3><div class='docblock'><p>Reads an unsigned n-bytes integer from <code>buf</code>.</p>
<h1 id="panics-5" class="section-header"><a href="#panics-5">Panics</a></h1>
<p>Panics when <code>nbytes &lt; 1</code> or <code>nbytes &gt; 16</code> or
<code>buf.len() &lt; nbytes</code></p>
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
<p>Write and read an n-byte number in little endian order:</p>
<div class="example-wrap"><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_uint128</span>(<span class="kw-2">&amp;</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_uint128</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>, <span class="number">3</span>));</pre></div>
</div><h3 id='tymethod.write_u16' class='method'><code id='write_u16.v'>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">&amp;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></h3><div class='docblock'><p>Writes an unsigned 16 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() &lt; 2</code>.</p>
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
<p>Write and read <code>u16</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_u16</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='tymethod.write_u32' class='method'><code id='write_u32.v'>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">&amp;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></h3><div class='docblock'><p>Writes an unsigned 32 bit integer <code>n</code> to <code>buf</code>.</p>
<h1 id="panics-7" class="section-header"><a href="#panics-7">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 4</code>.</p>
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
<p>Write and read <code>u32</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='tymethod.write_u64' class='method'><code id='write_u64.v'>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">&amp;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></h3><div class='docblock'><p>Writes an unsigned 64 bit integer <code>n</code> to <code>buf</code>.</p>
<h1 id="panics-8" class="section-header"><a href="#panics-8">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 8</code>.</p>
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
<p>Write and read <code>u64</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='tymethod.write_u128' class='method'><code id='write_u128.v'>fn <a href='#tymethod.write_u128' class='fnname'>write_u128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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.u128.html">u128</a>)</code></h3><div class='docblock'><p>Writes an unsigned 128 bit integer <code>n</code> to <code>buf</code>.</p>
<h1 id="panics-9" class="section-header"><a href="#panics-9">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 16</code>.</p>
<h1 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h1>
<p>Write and read <code>u128</code> numbers in little endian order:</p>
<div class="example-wrap"><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">16</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_u128</span>(<span class="kw-2">&amp;</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_u128</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='tymethod.write_uint' class='method'><code id='write_uint.v'>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">&amp;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></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-10" class="section-header"><a href="#panics-10">Panics</a></h1>
<p>If <code>n</code> is not representable in <code>nbytes</code>, or if <code>nbytes</code> is <code>&gt; 8</code>, then
this method panics.</p>
<h1 id="examples-10" class="section-header"><a href="#examples-10">Examples</a></h1>
<p>Write and read an n-byte number in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>, <span class="number">3</span>));</pre></div>
</div><h3 id='tymethod.write_uint128' class='method'><code id='write_uint128.v'>fn <a href='#tymethod.write_uint128' class='fnname'>write_uint128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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.u128.html">u128</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></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-11" class="section-header"><a href="#panics-11">Panics</a></h1>
<p>If <code>n</code> is not representable in <code>nbytes</code>, or if <code>nbytes</code> is <code>&gt; 16</code>, then
this method panics.</p>
<h1 id="examples-11" class="section-header"><a href="#examples-11">Examples</a></h1>
<p>Write and read an n-byte number in little endian order:</p>
<div class="example-wrap"><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_uint128</span>(<span class="kw-2">&amp;</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_uint128</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>, <span class="number">3</span>));</pre></div>
</div><h3 id='tymethod.read_u16_into' class='method'><code id='read_u16_into.v'>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">&amp;[</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">&amp;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></h3><div class='docblock'><p>Reads unsigned 16 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>src.len() != 2*dst.len()</code>.</p>
<h1 id="examples-12" class="section-header"><a href="#examples-12">Examples</a></h1>
<p>Write and read <code>u16</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='tymethod.read_u32_into' class='method'><code id='read_u32_into.v'>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">&amp;[</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">&amp;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></h3><div class='docblock'><p>Reads unsigned 32 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>src.len() != 4*dst.len()</code>.</p>
<h1 id="examples-13" class="section-header"><a href="#examples-13">Examples</a></h1>
<p>Write and read <code>u32</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='tymethod.read_u64_into' class='method'><code id='read_u64_into.v'>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">&amp;[</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">&amp;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></h3><div class='docblock'><p>Reads unsigned 64 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-14" class="section-header"><a href="#panics-14">Panics</a></h1>
<p>Panics when <code>src.len() != 8*dst.len()</code>.</p>
<h1 id="examples-14" class="section-header"><a href="#examples-14">Examples</a></h1>
<p>Write and read <code>u64</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='tymethod.read_u128_into' class='method'><code id='read_u128_into.v'>fn <a href='#tymethod.read_u128_into' class='fnname'>read_u128_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></h3><div class='docblock'><p>Reads unsigned 128 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-15" class="section-header"><a href="#panics-15">Panics</a></h1>
<p>Panics when <code>src.len() != 16*dst.len()</code>.</p>
<h1 id="examples-15" class="section-header"><a href="#examples-15">Examples</a></h1>
<p>Write and read <code>u128</code> numbers in little endian order:</p>
<div class="example-wrap"><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">64</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_u128_into</span>(<span class="kw-2">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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_u128_into</span>(<span class="kw-2">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='tymethod.write_u16_into' class='method'><code id='write_u16_into.v'>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">&amp;[</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">&amp;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></h3><div class='docblock'><p>Writes unsigned 16 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-16" class="section-header"><a href="#panics-16">Panics</a></h1>
<p>Panics when <code>dst.len() != 2*src.len()</code>.</p>
<h1 id="examples-16" class="section-header"><a href="#examples-16">Examples</a></h1>
<p>Write and read <code>u16</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='tymethod.write_u32_into' class='method'><code id='write_u32_into.v'>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">&amp;[</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">&amp;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></h3><div class='docblock'><p>Writes unsigned 32 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-17" class="section-header"><a href="#panics-17">Panics</a></h1>
<p>Panics when <code>dst.len() != 4*src.len()</code>.</p>
<h1 id="examples-17" class="section-header"><a href="#examples-17">Examples</a></h1>
<p>Write and read <code>u32</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='tymethod.write_u64_into' class='method'><code id='write_u64_into.v'>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">&amp;[</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">&amp;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></h3><div class='docblock'><p>Writes unsigned 64 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-18" class="section-header"><a href="#panics-18">Panics</a></h1>
<p>Panics when <code>dst.len() != 8*src.len()</code>.</p>
<h1 id="examples-18" class="section-header"><a href="#examples-18">Examples</a></h1>
<p>Write and read <code>u64</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='tymethod.write_u128_into' class='method'><code id='write_u128_into.v'>fn <a href='#tymethod.write_u128_into' class='fnname'>write_u128_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</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">&amp;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></h3><div class='docblock'><p>Writes unsigned 128 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-19" class="section-header"><a href="#panics-19">Panics</a></h1>
<p>Panics when <code>dst.len() != 16*src.len()</code>.</p>
<h1 id="examples-19" class="section-header"><a href="#examples-19">Examples</a></h1>
<p>Write and read <code>u128</code> numbers in little endian order:</p>
<div class="example-wrap"><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">64</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_u128_into</span>(<span class="kw-2">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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_u128_into</span>(<span class="kw-2">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='tymethod.from_slice_u16' class='method'><code id='from_slice_u16.v'>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">&amp;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></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-20" class="section-header"><a href="#examples-20">Examples</a></h1>
<p>Convert the host platform's endianness to big-endian:</p>
<div class="example-wrap"><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">&amp;</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5u16</span>.<span class="ident">to_be</span>(), <span class="number">65000u16</span>.<span class="ident">to_be</span>()]);</pre></div>
</div><h3 id='tymethod.from_slice_u32' class='method'><code id='from_slice_u32.v'>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">&amp;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></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-21" class="section-header"><a href="#examples-21">Examples</a></h1>
<p>Convert the host platform's endianness to big-endian:</p>
<div class="example-wrap"><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">&amp;</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5u32</span>.<span class="ident">to_be</span>(), <span class="number">65000u32</span>.<span class="ident">to_be</span>()]);</pre></div>
</div><h3 id='tymethod.from_slice_u64' class='method'><code id='from_slice_u64.v'>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">&amp;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></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-22" class="section-header"><a href="#examples-22">Examples</a></h1>
<p>Convert the host platform's endianness to big-endian:</p>
<div class="example-wrap"><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">&amp;</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5u64</span>.<span class="ident">to_be</span>(), <span class="number">65000u64</span>.<span class="ident">to_be</span>()]);</pre></div>
</div><h3 id='tymethod.from_slice_u128' class='method'><code id='from_slice_u128.v'>fn <a href='#tymethod.from_slice_u128' class='fnname'>from_slice_u128</a>(numbers: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></h3><div class='docblock'><p>Converts the given slice of unsigned 128 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-23" class="section-header"><a href="#examples-23">Examples</a></h1>
<p>Convert the host platform's endianness to big-endian:</p>
<div class="example-wrap"><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_u128</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5u128</span>.<span class="ident">to_be</span>(), <span class="number">65000u128</span>.<span class="ident">to_be</span>()]);</pre></div>
</div><h3 id='tymethod.from_slice_f32' class='method'><code id='from_slice_f32.v'>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">&amp;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></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>
</div><h3 id='tymethod.from_slice_f64' class='method'><code id='from_slice_f64.v'>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">&amp;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></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>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='provided-methods' class='small-section-header'>Provided methods<a href='#provided-methods' class='anchor'></a></h2><div class='methods'><h3 id='method.read_u24' class='method'><code id='read_u24.v'>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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code></h3><div class='docblock'><p>Reads an unsigned 24 bit integer from <code>buf</code>, stored in u32.</p>
<h1 id="panics-20" class="section-header"><a href="#panics-20">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 3</code>.</p>
<h1 id="examples-24" class="section-header"><a href="#examples-24">Examples</a></h1>
<p>Write and read 24 bit <code>u32</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.read_u48' class='method'><code id='read_u48.v'>fn <a href='#method.read_u48' class='fnname'>read_u48</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code></h3><div class='docblock'><p>Reads an unsigned 48 bit integer from <code>buf</code>, stored in u64.</p>
<h1 id="panics-21" class="section-header"><a href="#panics-21">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 6</code>.</p>
<h1 id="examples-25" class="section-header"><a href="#examples-25">Examples</a></h1>
<p>Write and read 48 bit <code>u64</code> numbers in little endian order:</p>
<div class="example-wrap"><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">6</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_u48</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000_000_000_000</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_u48</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.write_u24' class='method'><code id='write_u24.v'>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">&amp;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></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-22" class="section-header"><a href="#panics-22">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 3</code>.</p>
<h1 id="examples-26" class="section-header"><a href="#examples-26">Examples</a></h1>
<p>Write and read 24 bit <code>u32</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.write_u48' class='method'><code id='write_u48.v'>fn <a href='#method.write_u48' class='fnname'>write_u48</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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></h3><div class='docblock'><p>Writes an unsigned 48 bit integer <code>n</code> to <code>buf</code>, stored in u64.</p>
<h1 id="panics-23" class="section-header"><a href="#panics-23">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 6</code>.</p>
<h1 id="examples-27" class="section-header"><a href="#examples-27">Examples</a></h1>
<p>Write and read 48 bit <code>u64</code> numbers in little endian order:</p>
<div class="example-wrap"><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">6</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_u48</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="number">1_000_000_000_000</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000_000_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_u48</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.read_i16' class='method'><code id='read_i16.v'>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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a></code></h3><div class='docblock'><p>Reads a signed 16 bit integer from <code>buf</code>.</p>
<h1 id="panics-24" class="section-header"><a href="#panics-24">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 2</code>.</p>
<h1 id="examples-28" class="section-header"><a href="#examples-28">Examples</a></h1>
<p>Write and read <code>i16</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.read_i24' class='method'><code id='read_i24.v'>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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></h3><div class='docblock'><p>Reads a signed 24 bit integer from <code>buf</code>, stored in i32.</p>
<h1 id="panics-25" class="section-header"><a href="#panics-25">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 3</code>.</p>
<h1 id="examples-29" class="section-header"><a href="#examples-29">Examples</a></h1>
<p>Write and read 24 bit <code>i32</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.read_i32' class='method'><code id='read_i32.v'>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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></h3><div class='docblock'><p>Reads a signed 32 bit integer from <code>buf</code>.</p>
<h1 id="panics-26" class="section-header"><a href="#panics-26">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 4</code>.</p>
<h1 id="examples-30" class="section-header"><a href="#examples-30">Examples</a></h1>
<p>Write and read <code>i32</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.read_i48' class='method'><code id='read_i48.v'>fn <a href='#method.read_i48' class='fnname'>read_i48</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code></h3><div class='docblock'><p>Reads a signed 48 bit integer from <code>buf</code>, stored in i64.</p>
<h1 id="panics-27" class="section-header"><a href="#panics-27">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 6</code>.</p>
<h1 id="examples-31" class="section-header"><a href="#examples-31">Examples</a></h1>
<p>Write and read 48 bit <code>i64</code> numbers in little endian order:</p>
<div class="example-wrap"><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">6</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_i48</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">1_000_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_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_i48</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.read_i64' class='method'><code id='read_i64.v'>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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code></h3><div class='docblock'><p>Reads a signed 64 bit integer from <code>buf</code>.</p>
<h1 id="panics-28" class="section-header"><a href="#panics-28">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 8</code>.</p>
<h1 id="examples-32" class="section-header"><a href="#examples-32">Examples</a></h1>
<p>Write and read <code>i64</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.read_i128' class='method'><code id='read_i128.v'>fn <a href='#method.read_i128' class='fnname'>read_i128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a></code></h3><div class='docblock'><p>Reads a signed 128 bit integer from <code>buf</code>.</p>
<h1 id="panics-29" class="section-header"><a href="#panics-29">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 16</code>.</p>
<h1 id="examples-33" class="section-header"><a href="#examples-33">Examples</a></h1>
<p>Write and read <code>i128</code> numbers in little endian order:</p>
<div class="example-wrap"><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">16</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_i128</span>(<span class="kw-2">&amp;</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_i128</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.read_int' class='method'><code id='read_int.v'>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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code></h3><div class='docblock'><p>Reads a signed n-bytes integer from <code>buf</code>.</p>
<h1 id="panics-30" class="section-header"><a href="#panics-30">Panics</a></h1>
<p>Panics when <code>nbytes &lt; 1</code> or <code>nbytes &gt; 8</code> or
<code>buf.len() &lt; nbytes</code></p>
<h1 id="examples-34" class="section-header"><a href="#examples-34">Examples</a></h1>
<p>Write and read n-length signed numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>, <span class="number">3</span>));</pre></div>
</div><h3 id='method.read_int128' class='method'><code id='read_int128.v'>fn <a href='#method.read_int128' class='fnname'>read_int128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a></code></h3><div class='docblock'><p>Reads a signed n-bytes integer from <code>buf</code>.</p>
<h1 id="panics-31" class="section-header"><a href="#panics-31">Panics</a></h1>
<p>Panics when <code>nbytes &lt; 1</code> or <code>nbytes &gt; 16</code> or
<code>buf.len() &lt; nbytes</code></p>
<h1 id="examples-35" class="section-header"><a href="#examples-35">Examples</a></h1>
<p>Write and read n-length signed numbers in little endian order:</p>
<div class="example-wrap"><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_int128</span>(<span class="kw-2">&amp;</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_int128</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>, <span class="number">3</span>));</pre></div>
</div><h3 id='method.read_f32' class='method'><code id='read_f32.v'>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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a></code></h3><div class='docblock'><p>Reads a IEEE754 single-precision (4 bytes) floating point number.</p>
<h1 id="panics-32" class="section-header"><a href="#panics-32">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 4</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>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.read_f64' class='method'><code id='read_f64.v'>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">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a></code></h3><div class='docblock'><p>Reads a IEEE754 double-precision (8 bytes) floating point number.</p>
<h1 id="panics-33" class="section-header"><a href="#panics-33">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 8</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>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.write_i16' class='method'><code id='write_i16.v'>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">&amp;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></h3><div class='docblock'><p>Writes a signed 16 bit integer <code>n</code> to <code>buf</code>.</p>
<h1 id="panics-34" class="section-header"><a href="#panics-34">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 2</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>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.write_i24' class='method'><code id='write_i24.v'>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">&amp;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></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-35" class="section-header"><a href="#panics-35">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 3</code>.</p>
<h1 id="examples-39" class="section-header"><a href="#examples-39">Examples</a></h1>
<p>Write and read 24 bit <code>i32</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.write_i32' class='method'><code id='write_i32.v'>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">&amp;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></h3><div class='docblock'><p>Writes a signed 32 bit integer <code>n</code> to <code>buf</code>.</p>
<h1 id="panics-36" class="section-header"><a href="#panics-36">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 4</code>.</p>
<h1 id="examples-40" class="section-header"><a href="#examples-40">Examples</a></h1>
<p>Write and read <code>i32</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.write_i48' class='method'><code id='write_i48.v'>fn <a href='#method.write_i48' class='fnname'>write_i48</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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></h3><div class='docblock'><p>Writes a signed 48 bit integer <code>n</code> to <code>buf</code>, stored in i64.</p>
<h1 id="panics-37" class="section-header"><a href="#panics-37">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 6</code>.</p>
<h1 id="examples-41" class="section-header"><a href="#examples-41">Examples</a></h1>
<p>Write and read 48 bit <code>i64</code> numbers in little endian order:</p>
<div class="example-wrap"><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">6</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_i48</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">buf</span>, <span class="op">-</span><span class="number">1_000_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_000</span>, <span class="ident">LittleEndian</span>::<span class="ident">read_i48</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.write_i64' class='method'><code id='write_i64.v'>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">&amp;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></h3><div class='docblock'><p>Writes a signed 64 bit integer <code>n</code> to <code>buf</code>.</p>
<h1 id="panics-38" class="section-header"><a href="#panics-38">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 8</code>.</p>
<h1 id="examples-42" class="section-header"><a href="#examples-42">Examples</a></h1>
<p>Write and read <code>i64</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.write_i128' class='method'><code id='write_i128.v'>fn <a href='#method.write_i128' class='fnname'>write_i128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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.i128.html">i128</a>)</code></h3><div class='docblock'><p>Writes a signed 128 bit integer <code>n</code> to <code>buf</code>.</p>
<h1 id="panics-39" class="section-header"><a href="#panics-39">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 16</code>.</p>
<h1 id="examples-43" class="section-header"><a href="#examples-43">Examples</a></h1>
<p>Write and read n-byte <code>i128</code> numbers in little endian order:</p>
<div class="example-wrap"><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">16</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_i128</span>(<span class="kw-2">&amp;</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_i128</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.write_int' class='method'><code id='write_int.v'>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">&amp;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></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-40" class="section-header"><a href="#panics-40">Panics</a></h1>
<p>If <code>n</code> is not representable in <code>nbytes</code>, or if <code>nbytes</code> is <code>&gt; 8</code>, then
this method panics.</p>
<h1 id="examples-44" class="section-header"><a href="#examples-44">Examples</a></h1>
<p>Write and read an n-byte number in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>, <span class="number">3</span>));</pre></div>
</div><h3 id='method.write_int128' class='method'><code id='write_int128.v'>fn <a href='#method.write_int128' class='fnname'>write_int128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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.i128.html">i128</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></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-41" class="section-header"><a href="#panics-41">Panics</a></h1>
<p>If <code>n</code> is not representable in <code>nbytes</code>, or if <code>nbytes</code> is <code>&gt; 16</code>, then
this method panics.</p>
<h1 id="examples-45" class="section-header"><a href="#examples-45">Examples</a></h1>
<p>Write and read n-length signed numbers in little endian order:</p>
<div class="example-wrap"><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_int128</span>(<span class="kw-2">&amp;</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_int128</span>(<span class="kw-2">&amp;</span><span class="ident">buf</span>, <span class="number">3</span>));</pre></div>
</div><h3 id='method.write_f32' class='method'><code id='write_f32.v'>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">&amp;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></h3><div class='docblock'><p>Writes a IEEE754 single-precision (4 bytes) floating point number.</p>
<h1 id="panics-42" class="section-header"><a href="#panics-42">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 4</code>.</p>
<h1 id="examples-46" class="section-header"><a href="#examples-46">Examples</a></h1>
<p>Write and read <code>f32</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.write_f64' class='method'><code id='write_f64.v'>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">&amp;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></h3><div class='docblock'><p>Writes a IEEE754 double-precision (8 bytes) floating point number.</p>
<h1 id="panics-43" class="section-header"><a href="#panics-43">Panics</a></h1>
<p>Panics when <code>buf.len() &lt; 8</code>.</p>
<h1 id="examples-47" class="section-header"><a href="#examples-47">Examples</a></h1>
<p>Write and read <code>f64</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</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">&amp;</span><span class="ident">buf</span>));</pre></div>
</div><h3 id='method.read_i16_into' class='method'><code id='read_i16_into.v'>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">&amp;[</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">&amp;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></h3><div class='docblock'><p>Reads signed 16 bit integers from <code>src</code> to <code>dst</code>.</p>
<h1 id="panics-44" class="section-header"><a href="#panics-44">Panics</a></h1>
<p>Panics when <code>buf.len() != 2*dst.len()</code>.</p>
<h1 id="examples-48" class="section-header"><a href="#examples-48">Examples</a></h1>
<p>Write and read <code>i16</code> numbers in little endian order:</p>
<div class="example-wrap"><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">0x0f</span>, <span class="number">0xee</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_i16_into</span>(<span class="kw-2">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.read_i32_into' class='method'><code id='read_i32_into.v'>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">&amp;[</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">&amp;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></h3><div class='docblock'><p>Reads signed 32 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-45" class="section-header"><a href="#panics-45">Panics</a></h1>
<p>Panics when <code>src.len() != 4*dst.len()</code>.</p>
<h1 id="examples-49" class="section-header"><a href="#examples-49">Examples</a></h1>
<p>Write and read <code>i32</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.read_i64_into' class='method'><code id='read_i64_into.v'>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">&amp;[</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">&amp;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></h3><div class='docblock'><p>Reads signed 64 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-46" class="section-header"><a href="#panics-46">Panics</a></h1>
<p>Panics when <code>src.len() != 8*dst.len()</code>.</p>
<h1 id="examples-50" class="section-header"><a href="#examples-50">Examples</a></h1>
<p>Write and read <code>i64</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.read_i128_into' class='method'><code id='read_i128_into.v'>fn <a href='#method.read_i128_into' class='fnname'>read_i128_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></h3><div class='docblock'><p>Reads signed 128 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-47" class="section-header"><a href="#panics-47">Panics</a></h1>
<p>Panics when <code>src.len() != 16*dst.len()</code>.</p>
<h1 id="examples-51" class="section-header"><a href="#examples-51">Examples</a></h1>
<p>Write and read <code>i128</code> numbers in little endian order:</p>
<div class="example-wrap"><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">64</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_i128_into</span>(<span class="kw-2">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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_i128_into</span>(<span class="kw-2">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.read_f32_into' class='method'><code id='read_f32_into.v'>fn <a href='#method.read_f32_into' class='fnname'>read_f32_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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">&amp;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></h3><div class='docblock'><p>Reads IEEE754 single-precision (4 bytes) floating point numbers from
<code>src</code> into <code>dst</code>.</p>
<h1 id="panics-48" class="section-header"><a href="#panics-48">Panics</a></h1>
<p>Panics when <code>src.len() != 4*dst.len()</code>.</p>
<h1 id="examples-52" class="section-header"><a href="#examples-52">Examples</a></h1>
<p>Write and read <code>f32</code> numbers in little endian order:</p>
<div class="example-wrap"><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.312e31</span>, <span class="op">-</span><span class="number">11.32e19</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_f32_into</span>(<span class="kw-2">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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="ident">LittleEndian</span>::<span class="ident">read_f32_into</span>(<span class="kw-2">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.read_f32_into_unchecked' class='method'><code id='read_f32_into_unchecked.v'>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">&amp;[</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">&amp;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></h3><div class='stability'><div class='stab deprecated'>Deprecated since 1.3.0: <p>please use <code>read_f32_into</code> instead</p>
</div></div><div class='docblock'><p><strong>DEPRECATED</strong>.</p>
<p>This method is deprecated. Use <code>read_f32_into</code> instead.
Reads IEEE754 single-precision (4 bytes) floating point numbers from
<code>src</code> into <code>dst</code>.</p>
<h1 id="panics-49" class="section-header"><a href="#panics-49">Panics</a></h1>
<p>Panics when <code>src.len() != 4*dst.len()</code>.</p>
<h1 id="examples-53" class="section-header"><a href="#examples-53">Examples</a></h1>
<p>Write and read <code>f32</code> numbers in little endian order:</p>
<div class="example-wrap"><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.312e31</span>, <span class="op">-</span><span class="number">11.32e19</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_f32_into</span>(<span class="kw-2">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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="ident">LittleEndian</span>::<span class="ident">read_f32_into_unchecked</span>(<span class="kw-2">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.read_f64_into' class='method'><code id='read_f64_into.v'>fn <a href='#method.read_f64_into' class='fnname'>read_f64_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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">&amp;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></h3><div class='docblock'><p>Reads IEEE754 single-precision (4 bytes) floating point numbers from
<code>src</code> into <code>dst</code>.</p>
<h1 id="panics-50" class="section-header"><a href="#panics-50">Panics</a></h1>
<p>Panics when <code>src.len() != 8*dst.len()</code>.</p>
<h1 id="examples-54" class="section-header"><a href="#examples-54">Examples</a></h1>
<p>Write and read <code>f64</code> numbers in little endian order:</p>
<div class="example-wrap"><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.312e211</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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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="ident">LittleEndian</span>::<span class="ident">read_f64_into</span>(<span class="kw-2">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.read_f64_into_unchecked' class='method'><code id='read_f64_into_unchecked.v'>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">&amp;[</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">&amp;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></h3><div class='stability'><div class='stab deprecated'>Deprecated since 1.3.0: <p>please use <code>read_f64_into</code> instead</p>
</div></div><div class='docblock'><p><strong>DEPRECATED</strong>.</p>
<p>This method is deprecated. Use <code>read_f64_into</code> instead.</p>
<p>Reads IEEE754 single-precision (4 bytes) floating point numbers from
<code>src</code> into <code>dst</code>.</p>
<h1 id="panics-51" class="section-header"><a href="#panics-51">Panics</a></h1>
<p>Panics when <code>src.len() != 8*dst.len()</code>.</p>
<h1 id="examples-55" class="section-header"><a href="#examples-55">Examples</a></h1>
<p>Write and read <code>f64</code> numbers in little endian order:</p>
<div class="example-wrap"><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.312e211</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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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="ident">LittleEndian</span>::<span class="ident">read_f64_into_unchecked</span>(<span class="kw-2">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.write_i16_into' class='method'><code id='write_i16_into.v'>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">&amp;[</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">&amp;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></h3><div class='docblock'><p>Writes signed 16 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-52" class="section-header"><a href="#panics-52">Panics</a></h1>
<p>Panics when <code>buf.len() != 2*src.len()</code>.</p>
<h1 id="examples-56" class="section-header"><a href="#examples-56">Examples</a></h1>
<p>Write and read <code>i16</code> numbers in little endian order:</p>
<div class="example-wrap"><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">0x0f</span>, <span class="number">0xee</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_i16_into</span>(<span class="kw-2">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.write_i32_into' class='method'><code id='write_i32_into.v'>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">&amp;[</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">&amp;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></h3><div class='docblock'><p>Writes signed 32 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-53" class="section-header"><a href="#panics-53">Panics</a></h1>
<p>Panics when <code>dst.len() != 4*src.len()</code>.</p>
<h1 id="examples-57" class="section-header"><a href="#examples-57">Examples</a></h1>
<p>Write and read <code>i32</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.write_i64_into' class='method'><code id='write_i64_into.v'>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">&amp;[</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">&amp;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></h3><div class='docblock'><p>Writes signed 64 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-54" class="section-header"><a href="#panics-54">Panics</a></h1>
<p>Panics when <code>dst.len() != 8*src.len()</code>.</p>
<h1 id="examples-58" class="section-header"><a href="#examples-58">Examples</a></h1>
<p>Write and read <code>i64</code> numbers in little endian order:</p>
<div class="example-wrap"><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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.write_i128_into' class='method'><code id='write_i128_into.v'>fn <a href='#method.write_i128_into' class='fnname'>write_i128_into</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</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">&amp;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></h3><div class='docblock'><p>Writes signed 128 bit integers from <code>src</code> into <code>dst</code>.</p>
<h1 id="panics-55" class="section-header"><a href="#panics-55">Panics</a></h1>
<p>Panics when <code>dst.len() != 16*src.len()</code>.</p>
<h1 id="examples-59" class="section-header"><a href="#examples-59">Examples</a></h1>
<p>Write and read <code>i128</code> numbers in little endian order:</p>
<div class="example-wrap"><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">64</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_i128_into</span>(<span class="kw-2">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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_i128_into</span>(<span class="kw-2">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.write_f32_into' class='method'><code id='write_f32_into.v'>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">&amp;[</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">&amp;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></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-56" class="section-header"><a href="#panics-56">Panics</a></h1>
<p>Panics when <code>src.len() != 4*dst.len()</code>.</p>
<h1 id="examples-60" class="section-header"><a href="#examples-60">Examples</a></h1>
<p>Write and read <code>f32</code> numbers in little endian order:</p>
<div class="example-wrap"><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.312e31</span>, <span class="op">-</span><span class="number">11.32e19</span>];
<span class="ident">LittleEndian</span>::<span class="ident">write_f32_into</span>(<span class="kw-2">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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</span>(<span class="kw-2">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.write_f64_into' class='method'><code id='write_f64_into.v'>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">&amp;[</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">&amp;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></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-57" class="section-header"><a href="#panics-57">Panics</a></h1>
<p>Panics when <code>src.len() != 8*dst.len()</code>.</p>
<h1 id="examples-61" class="section-header"><a href="#examples-61">Examples</a></h1>
<p>Write and read <code>f64</code> numbers in little endian order:</p>
<div class="example-wrap"><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.312e211</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">&amp;</span><span class="ident">numbers_given</span>, <span class="kw-2">&amp;</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</span>(<span class="kw-2">&amp;</span><span class="ident">bytes</span>, <span class="kw-2">&amp;</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>
</div><h3 id='method.from_slice_i16' class='method'><code id='from_slice_i16.v'>fn <a href='#method.from_slice_i16' class='fnname'>from_slice_i16</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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></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-62" class="section-header"><a href="#examples-62">Examples</a></h1>
<p>Convert the host platform's endianness to big-endian:</p>
<div class="example-wrap"><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">6500</span>];
<span class="ident">BigEndian</span>::<span class="ident">from_slice_i16</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5i16</span>.<span class="ident">to_be</span>(), <span class="number">6500i16</span>.<span class="ident">to_be</span>()]);</pre></div>
</div><h3 id='method.from_slice_i32' class='method'><code id='from_slice_i32.v'>fn <a href='#method.from_slice_i32' class='fnname'>from_slice_i32</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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></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-63" class="section-header"><a href="#examples-63">Examples</a></h1>
<p>Convert the host platform's endianness to big-endian:</p>
<div class="example-wrap"><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">&amp;</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5i32</span>.<span class="ident">to_be</span>(), <span class="number">65000i32</span>.<span class="ident">to_be</span>()]);</pre></div>
</div><h3 id='method.from_slice_i64' class='method'><code id='from_slice_i64.v'>fn <a href='#method.from_slice_i64' class='fnname'>from_slice_i64</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;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></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-64" class="section-header"><a href="#examples-64">Examples</a></h1>
<p>Convert the host platform's endianness to big-endian:</p>
<div class="example-wrap"><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">&amp;</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5i64</span>.<span class="ident">to_be</span>(), <span class="number">65000i64</span>.<span class="ident">to_be</span>()]);</pre></div>
</div><h3 id='method.from_slice_i128' class='method'><code id='from_slice_i128.v'>fn <a href='#method.from_slice_i128' class='fnname'>from_slice_i128</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></h3><div class='docblock'><p>Converts the given slice of signed 128 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-65" class="section-header"><a href="#examples-65">Examples</a></h1>
<p>Convert the host platform's endianness to big-endian:</p>
<div class="example-wrap"><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_i128</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">numbers</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">numbers</span>, [<span class="number">5i128</span>.<span class="ident">to_be</span>(), <span class="number">65000i128</span>.<span class="ident">to_be</span>()]);</pre></div>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-ByteOrder' class='impl'><code class='in-band'>impl ByteOrder for <a class="enum" href="../byteorder/enum.BigEndian.html" title="enum byteorder::BigEndian">BigEndian</a></code><a href='#impl-ByteOrder' class='anchor'></a><a class='srclink' href='../src/byteorder/lib.rs.html#1957-2170' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.read_u16' class="method hidden"><code id='read_u16.v-1'>fn <a href='#method.read_u16' class='fnname'>read_u16</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a></code><a class='srclink' href='../src/byteorder/lib.rs.html#1959-1961' title='goto source code'>[src]</a></h4><h4 id='method.read_u32' class="method hidden"><code id='read_u32.v-1'>fn <a href='#method.read_u32' class='fnname'>read_u32</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code><a class='srclink' href='../src/byteorder/lib.rs.html#1964-1966' title='goto source code'>[src]</a></h4><h4 id='method.read_u64' class="method hidden"><code id='read_u64.v-1'>fn <a href='#method.read_u64' class='fnname'>read_u64</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code><a class='srclink' href='../src/byteorder/lib.rs.html#1969-1971' title='goto source code'>[src]</a></h4><h4 id='method.read_u128' class="method hidden"><code id='read_u128.v-1'>fn <a href='#method.read_u128' class='fnname'>read_u128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a></code><a class='srclink' href='../src/byteorder/lib.rs.html#1975-1977' title='goto source code'>[src]</a></h4><h4 id='method.read_uint' class="method hidden"><code id='read_uint.v-1'>fn <a href='#method.read_uint' class='fnname'>read_uint</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</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>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code><a class='srclink' href='../src/byteorder/lib.rs.html#1980-1989' title='goto source code'>[src]</a></h4><h4 id='method.read_uint128' class="method hidden"><code id='read_uint128.v-1'>fn <a href='#method.read_uint128' class='fnname'>read_uint128</a>(buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html
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><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse 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><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "byteorder";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>