forked from diesel-rs/diesel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrait.WriteBytesExt.html
More file actions
259 lines (223 loc) · 59.2 KB
/
Copy pathtrait.WriteBytesExt.html
File metadata and controls
259 lines (223 loc) · 59.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!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="Extends `Write` with methods for writing numbers. (For `std::io`.)"><meta name="keywords" content="rust, rustlang, rust-lang, WriteBytesExt"><title>WriteBytesExt in byteorder - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../byteorder/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div>
</a><h2 class="location"></h2>
</nav>
<nav class="sidebar"><a class="sidebar-logo" href="../byteorder/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div>
</a><h2 class="location"><a href="#">WriteBytesExt</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#provided-methods">Provided Methods</a></h3><ul><li><a href="#method.write_f32">write_f32</a></li><li><a href="#method.write_f64">write_f64</a></li><li><a href="#method.write_i128">write_i128</a></li><li><a href="#method.write_i16">write_i16</a></li><li><a href="#method.write_i24">write_i24</a></li><li><a href="#method.write_i32">write_i32</a></li><li><a href="#method.write_i48">write_i48</a></li><li><a href="#method.write_i64">write_i64</a></li><li><a href="#method.write_i8">write_i8</a></li><li><a href="#method.write_int">write_int</a></li><li><a href="#method.write_int128">write_int128</a></li><li><a href="#method.write_u128">write_u128</a></li><li><a href="#method.write_u16">write_u16</a></li><li><a href="#method.write_u24">write_u24</a></li><li><a href="#method.write_u32">write_u32</a></li><li><a href="#method.write_u48">write_u48</a></li><li><a href="#method.write_u64">write_u64</a></li><li><a href="#method.write_u8">write_u8</a></li><li><a href="#method.write_uint">write_uint</a></li><li><a href="#method.write_uint128">write_uint128</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div></section><h2 class="location"><a href="index.html">In byteorder</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../byteorder/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1">
<a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div>
</div></form></nav></div><section id="main-content" class="content"><div class="main-heading">
<h1 class="fqn"><span class="in-band">Trait <a href="index.html">byteorder</a>::<wbr><a class="trait" href="#">WriteBytesExt</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/byteorder/io.rs.html#1073-1575">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="docblock item-decl"><pre class="rust trait"><code>pub trait WriteBytesExt: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> {
<details class="rustdoc-toggle type-contents-toggle"><summary class="hideme"><span>Show 20 methods</span></summary> fn <a href="#method.write_u8" class="fnname">write_u8</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_i8" class="fnname">write_i8</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_u16" class="fnname">write_u16</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_i16" class="fnname">write_i16</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_u24" class="fnname">write_u24</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_i24" class="fnname">write_i24</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_u32" class="fnname">write_u32</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_i32" class="fnname">write_i32</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_u48" class="fnname">write_u48</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_i48" class="fnname">write_i48</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_u64" class="fnname">write_u64</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_i64" class="fnname">write_i64</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_u128" class="fnname">write_u128</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_i128" class="fnname">write_i128</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_uint" class="fnname">write_uint</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, 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>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_int" class="fnname">write_int</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, 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>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_uint128" class="fnname">write_uint128</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(<br> &mut self, <br> n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a>, <br> nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a><br> ) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_int128" class="fnname">write_int128</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(<br> &mut self, <br> n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a>, <br> nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a><br> ) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_f32" class="fnname">write_f32</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
<span class="item-spacer"></span> fn <a href="#method.write_f64" class="fnname">write_f64</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
</details>}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extends <a href="https://doc.rust-lang.org/std/io/trait.Write.html"><code>Write</code></a> with methods for writing numbers. (For <code>std::io</code>.)</p>
<p>Most of the methods defined here have an unconstrained type parameter that
must be explicitly instantiated. Typically, it is instantiated with either
the <a href="enum.BigEndian.html"><code>BigEndian</code></a> or <a href="enum.LittleEndian.html"><code>LittleEndian</code></a> types defined in this crate.</p>
<h2 id="examples"><a href="#examples">Examples</a></h2>
<p>Write unsigned 16 bit big-endian integers to a <a href="https://doc.rust-lang.org/std/io/trait.Write.html"><code>Write</code></a>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="macro">vec!</span>[];
<span class="ident">wtr</span>.<span class="ident">write_u16</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">517</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_u16</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">768</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">0</span>]);</code></pre></div>
</div></details><h2 id="provided-methods" class="small-section-header">Provided Methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="method.write_u8" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1098-1100">source</a></div><h4 class="code-header">fn <a href="#method.write_u8" class="fnname">write_u8</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes an unsigned 8 bit integer to the underlying writer.</p>
<p>Note that since this writes a single byte, no byte order conversions
are used. It is included for completeness.</p>
<h5 id="errors"><a href="#errors">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<p>Write unsigned 8 bit integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder::WriteBytesExt</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_u8</span>(<span class="number">2</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_u8</span>(<span class="number">5</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x02\x05"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_i8" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1126-1128">source</a></div><h4 class="code-header">fn <a href="#method.write_i8" class="fnname">write_i8</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes a signed 8 bit integer to the underlying writer.</p>
<p>Note that since this writes a single byte, no byte order conversions
are used. It is included for completeness.</p>
<h5 id="errors-1"><a href="#errors-1">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<p>Write signed 8 bit integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder::WriteBytesExt</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_i8</span>(<span class="number">2</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_i8</span>(<span class="op">-</span><span class="number">5</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x02\xfb"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_u16" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1151-1155">source</a></div><h4 class="code-header">fn <a href="#method.write_u16" class="fnname">write_u16</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes an unsigned 16 bit integer to the underlying writer.</p>
<h5 id="errors-2"><a href="#errors-2">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<p>Write unsigned 16 bit big-endian integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_u16</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">517</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_u16</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">768</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x02\x05\x03\x00"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_i16" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1178-1182">source</a></div><h4 class="code-header">fn <a href="#method.write_i16" class="fnname">write_i16</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes a signed 16 bit integer to the underlying writer.</p>
<h5 id="errors-3"><a href="#errors-3">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<p>Write signed 16 bit big-endian integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_i16</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">193</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_i16</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="op">-</span><span class="number">132</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x00\xc1\xff\x7c"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_u24" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1205-1209">source</a></div><h4 class="code-header">fn <a href="#method.write_u24" class="fnname">write_u24</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes an unsigned 24 bit integer to the underlying writer.</p>
<h5 id="errors-4"><a href="#errors-4">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<p>Write unsigned 24 bit big-endian integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_u24</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">267</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_u24</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">120111</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x00\x01\x0b\x01\xd5\x2f"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_i24" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1232-1236">source</a></div><h4 class="code-header">fn <a href="#method.write_i24" class="fnname">write_i24</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes a signed 24 bit integer to the underlying writer.</p>
<h5 id="errors-5"><a href="#errors-5">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<p>Write signed 24 bit big-endian integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_i24</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="op">-</span><span class="number">34253</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_i24</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">120111</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\xff\x7a\x33\x01\xd5\x2f"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_u32" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1259-1263">source</a></div><h4 class="code-header">fn <a href="#method.write_u32" class="fnname">write_u32</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes an unsigned 32 bit integer to the underlying writer.</p>
<h5 id="errors-6"><a href="#errors-6">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<p>Write unsigned 32 bit big-endian integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_u32</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">267</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_u32</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">1205419366</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x00\x00\x01\x0b\x47\xd9\x3d\x66"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_i32" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1286-1290">source</a></div><h4 class="code-header">fn <a href="#method.write_i32" class="fnname">write_i32</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes a signed 32 bit integer to the underlying writer.</p>
<h5 id="errors-7"><a href="#errors-7">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<p>Write signed 32 bit big-endian integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_i32</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="op">-</span><span class="number">34253</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_i32</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">1205419366</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\xff\xff\x7a\x33\x47\xd9\x3d\x66"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_u48" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1313-1317">source</a></div><h4 class="code-header">fn <a href="#method.write_u48" class="fnname">write_u48</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes an unsigned 48 bit integer to the underlying writer.</p>
<h5 id="errors-8"><a href="#errors-8">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<p>Write unsigned 48 bit big-endian integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_u48</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">52360336390828</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_u48</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">541</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x2f\x9f\x17\x40\x3a\xac\x00\x00\x00\x00\x02\x1d"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_i48" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1340-1344">source</a></div><h4 class="code-header">fn <a href="#method.write_i48" class="fnname">write_i48</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes a signed 48 bit integer to the underlying writer.</p>
<h5 id="errors-9"><a href="#errors-9">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<p>Write signed 48 bit big-endian integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_i48</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="op">-</span><span class="number">108363435763825</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_i48</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">77</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x9d\x71\xab\xe7\x97\x8f\x00\x00\x00\x00\x00\x4d"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_u64" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1367-1371">source</a></div><h4 class="code-header">fn <a href="#method.write_u64" class="fnname">write_u64</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes an unsigned 64 bit integer to the underlying writer.</p>
<h5 id="errors-10"><a href="#errors-10">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<p>Write unsigned 64 bit big-endian integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_u64</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">918733457491587</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_u64</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">143</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x00\x03\x43\x95\x4d\x60\x86\x83\x00\x00\x00\x00\x00\x00\x00\x8f"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_i64" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1394-1398">source</a></div><h4 class="code-header">fn <a href="#method.write_i64" class="fnname">write_i64</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes a signed 64 bit integer to the underlying writer.</p>
<h5 id="errors-11"><a href="#errors-11">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-12"><a href="#examples-12">Examples</a></h5>
<p>Write signed 64 bit big-endian integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_i64</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="ident">i64::min_value</span>()).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_i64</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="ident">i64::max_value</span>()).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x80\x00\x00\x00\x00\x00\x00\x00\x7f\xff\xff\xff\xff\xff\xff\xff"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_u128" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1402-1406">source</a></div><h4 class="code-header">fn <a href="#method.write_u128" class="fnname">write_u128</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes an unsigned 128 bit integer to the underlying writer.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_i128" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1410-1414">source</a></div><h4 class="code-header">fn <a href="#method.write_i128" class="fnname">write_i128</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes a signed 128 bit integer to the underlying writer.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_uint" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1442-1450">source</a></div><h4 class="code-header">fn <a href="#method.write_uint" class="fnname">write_uint</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, 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>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes an unsigned n-bytes integer to the underlying writer.</p>
<h5 id="errors-12"><a href="#errors-12">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>If the given integer is not representable in the given number of bytes,
this method panics. If <code>nbytes > 8</code>, this method panics.</p>
<h5 id="examples-13"><a href="#examples-13">Examples</a></h5>
<p>Write unsigned 40 bit big-endian integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_uint</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">312550384361</span>, <span class="number">5</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_uint</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">43</span>, <span class="number">5</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x48\xc5\x74\x62\xe9\x00\x00\x00\x00\x2b"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_int" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1478-1486">source</a></div><h4 class="code-header">fn <a href="#method.write_int" class="fnname">write_int</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, 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>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes a signed n-bytes integer to the underlying writer.</p>
<h5 id="errors-13"><a href="#errors-13">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="panics-1"><a href="#panics-1">Panics</a></h5>
<p>If the given integer is not representable in the given number of bytes,
this method panics. If <code>nbytes > 8</code>, this method panics.</p>
<h5 id="examples-14"><a href="#examples-14">Examples</a></h5>
<p>Write signed 56 bit big-endian integers to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_int</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="op">-</span><span class="number">3548172039376767</span>, <span class="number">7</span>).<span class="ident">unwrap</span>();
<span class="ident">wtr</span>.<span class="ident">write_int</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="number">43</span>, <span class="number">7</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\xf3\x64\xf4\xd1\xfd\xb0\x81\x00\x00\x00\x00\x00\x00\x2b"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_uint128" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1493-1501">source</a></div><h4 class="code-header">fn <a href="#method.write_uint128" class="fnname">write_uint128</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, 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>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes an unsigned n-bytes integer to the underlying writer.</p>
<p>If the given integer is not representable in the given number of bytes,
this method panics. If <code>nbytes > 16</code>, this method panics.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_int128" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1508-1516">source</a></div><h4 class="code-header">fn <a href="#method.write_int128" class="fnname">write_int128</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, 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>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes a signed n-bytes integer to the underlying writer.</p>
<p>If the given integer is not representable in the given number of bytes,
this method panics. If <code>nbytes > 16</code>, this method panics.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_f32" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1541-1545">source</a></div><h4 class="code-header">fn <a href="#method.write_f32" class="fnname">write_f32</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes a IEEE754 single-precision (4 bytes) floating point number to
the underlying writer.</p>
<h5 id="errors-14"><a href="#errors-14">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-15"><a href="#examples-15">Examples</a></h5>
<p>Write a big-endian single-precision floating point number to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::f32</span>;
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_f32</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="ident">f32::consts::PI</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x40\x49\x0f\xdb"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.write_f64" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1570-1574">source</a></div><h4 class="code-header">fn <a href="#method.write_f64" class="fnname">write_f64</a><T: <a class="trait" href="trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Writes a IEEE754 double-precision (8 bytes) floating point number to
the underlying writer.</p>
<h5 id="errors-15"><a href="#errors-15">Errors</a></h5>
<p>This method returns the same errors as <a href="https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all"><code>Write::write_all</code></a>.</p>
<h5 id="examples-16"><a href="#examples-16">Examples</a></h5>
<p>Write a big-endian double-precision floating point number to a <code>Write</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::f64</span>;
<span class="kw">use</span> <span class="ident">byteorder</span>::{<span class="ident">BigEndian</span>, <span class="ident">WriteBytesExt</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="ident">wtr</span>.<span class="ident">write_f64</span>::<span class="op"><</span><span class="ident">BigEndian</span><span class="op">></span>(<span class="ident">f64::consts::PI</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">wtr</span>, <span class="string">b"\x40\x09\x21\xfb\x54\x44\x2d\x18"</span>);</code></pre></div>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><section id="impl-WriteBytesExt" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/byteorder/io.rs.html#1579">source</a></span><a href="#impl-WriteBytesExt" class="anchor"></a><h3 class="code-header in-band">impl<W: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>> <a class="trait" href="trait.WriteBytesExt.html" title="trait byteorder::WriteBytesExt">WriteBytesExt</a> for W</h3></section><div class="docblock"><p>All types that implement <code>Write</code> get methods defined in <code>WriteBytesExt</code>
for free.</p>
</div></div><script type="text/javascript" src="../implementors/byteorder/io/trait.WriteBytesExt.js" data-ignore-extern-crates="" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="byteorder" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (495b21669 2022-07-03)" ></div>
</body></html>