@@ -12,21 +12,15 @@ impl<T> FromStd<T> {
12
12
13
13
/// Returns the wrapped value.
14
14
#[inline]
15
- pub fn into_inner(self) -> T {
16
- self.0
17
- }
15
+ pub fn into_inner(self) -> T { self.0 }
18
16
19
17
/// Returns a reference to the wrapped value.
20
18
#[inline]
21
- pub fn inner(&self) -> &T {
22
- &self.0
23
- }
19
+ pub fn inner(&self) -> &T { &self.0 }
24
20
25
21
/// Returns a mutable reference to the wrapped value.
26
22
#[inline]
27
- pub fn inner_mut(&mut self) -> &mut T {
28
- &mut self.0
29
- }
23
+ pub fn inner_mut(&mut self) -> &mut T { &mut self.0 }
30
24
31
25
/// Wraps a mutable reference to IO type.
32
26
#[inline]
@@ -58,14 +52,10 @@ impl<T: std::io::Read> super::Read for FromStd<T> {
58
52
59
53
impl<T: std::io::BufRead> super::BufRead for FromStd<T> {
60
54
#[inline]
61
- fn fill_buf(&mut self) -> super::Result<&[u8]> {
62
- self.0.fill_buf().map_err(Into::into)
63
- }
55
+ fn fill_buf(&mut self) -> super::Result<&[u8]> { self.0.fill_buf().map_err(Into::into) }
64
56
65
57
#[inline]
66
- fn consume(&mut self, amount: usize) {
67
- self.0.consume(amount)
68
- }
58
+ fn consume(&mut self, amount: usize) { self.0.consume(amount) }
69
59
}
70
60
71
61
impl<T: std::io::Write> super::Write for FromStd<T> {
@@ -75,9 +65,7 @@ impl<T: std::io::Write> super::Write for FromStd<T> {
75
65
}
76
66
77
67
#[inline]
78
- fn flush(&mut self) -> super::Result<()> {
79
- self.0.flush().map_err(Into::into)
80
- }
68
+ fn flush(&mut self) -> super::Result<()> { self.0.flush().map_err(Into::into) }
81
69
82
70
#[inline]
83
71
fn write_all(&mut self, buf: &[u8]) -> super::Result<()> {
@@ -89,43 +77,29 @@ impl<T: std::io::Write> super::Write for FromStd<T> {
89
77
90
78
impl<T: std::io::Read> std::io::Read for FromStd<T> {
91
79
#[inline]
92
- fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
93
- self.0.read(buf)
94
- }
80
+ fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> { self.0.read(buf) }
95
81
96
82
#[inline]
97
- fn read_exact(&mut self, buf: &mut [u8]) -> std::io::Result<()> {
98
- self.0.read_exact(buf)
99
- }
83
+ fn read_exact(&mut self, buf: &mut [u8]) -> std::io::Result<()> { self.0.read_exact(buf) }
100
84
}
101
85
102
86
impl<T: std::io::BufRead> std::io::BufRead for FromStd<T> {
103
87
#[inline]
104
- fn fill_buf(&mut self) -> std::io::Result<&[u8]> {
105
- self.0.fill_buf()
106
- }
88
+ fn fill_buf(&mut self) -> std::io::Result<&[u8]> { self.0.fill_buf() }
107
89
108
90
#[inline]
109
- fn consume(&mut self, amount: usize) {
110
- self.0.consume(amount)
111
- }
91
+ fn consume(&mut self, amount: usize) { self.0.consume(amount) }
112
92
}
113
93
114
94
impl<T: std::io::Write> std::io::Write for FromStd<T> {
115
95
#[inline]
116
- fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
117
- self.0.write(buf)
118
- }
96
+ fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> { self.0.write(buf) }
119
97
120
98
#[inline]
121
- fn flush(&mut self) -> std::io::Result<()> {
122
- self.0.flush()
123
- }
99
+ fn flush(&mut self) -> std::io::Result<()> { self.0.flush() }
124
100
125
101
#[inline]
126
- fn write_all(&mut self, buf: &[u8]) -> std::io::Result<()> {
127
- self.0.write_all(buf)
128
- }
102
+ fn write_all(&mut self, buf: &[u8]) -> std::io::Result<()> { self.0.write_all(buf) }
129
103
}
130
104
131
105
/// A bridging wrapper providing the std traits for types that already implement our traits.
@@ -139,21 +113,15 @@ impl<T> ToStd<T> {
139
113
140
114
/// Returns the wrapped value.
141
115
#[inline]
142
- pub fn into_inner(self) -> T {
143
- self.0
144
- }
116
+ pub fn into_inner(self) -> T { self.0 }
145
117
146
118
/// Returns a reference to the wrapped value.
147
119
#[inline]
148
- pub fn inner(&self) -> &T {
149
- &self.0
150
- }
120
+ pub fn inner(&self) -> &T { &self.0 }
151
121
152
122
/// Returns a mutable reference to the wrapped value.
153
123
#[inline]
154
- pub fn inner_mut(&mut self) -> &mut T {
155
- &mut self.0
156
- }
124
+ pub fn inner_mut(&mut self) -> &mut T { &mut self.0 }
157
125
158
126
/// Wraps a mutable reference to IO type.
159
127
#[inline]
@@ -185,14 +153,10 @@ impl<T: super::Read> std::io::Read for ToStd<T> {
185
153
186
154
impl<T: super::BufRead> std::io::BufRead for ToStd<T> {
187
155
#[inline]
188
- fn fill_buf(&mut self) -> std::io::Result<&[u8]> {
189
- self.0.fill_buf().map_err(Into::into)
190
- }
156
+ fn fill_buf(&mut self) -> std::io::Result<&[u8]> { self.0.fill_buf().map_err(Into::into) }
191
157
192
158
#[inline]
193
- fn consume(&mut self, amount: usize) {
194
- self.0.consume(amount)
195
- }
159
+ fn consume(&mut self, amount: usize) { self.0.consume(amount) }
196
160
}
197
161
198
162
impl<T: super::Write> std::io::Write for ToStd<T> {
@@ -202,9 +166,7 @@ impl<T: super::Write> std::io::Write for ToStd<T> {
202
166
}
203
167
204
168
#[inline]
205
- fn flush(&mut self) -> std::io::Result<()> {
206
- self.0.flush().map_err(Into::into)
207
- }
169
+ fn flush(&mut self) -> std::io::Result<()> { self.0.flush().map_err(Into::into) }
208
170
209
171
#[inline]
210
172
fn write_all(&mut self, buf: &[u8]) -> std::io::Result<()> {
@@ -216,43 +178,29 @@ impl<T: super::Write> std::io::Write for ToStd<T> {
216
178
217
179
impl<T: super::Read> super::Read for ToStd<T> {
218
180
#[inline]
219
- fn read(&mut self, buf: &mut [u8]) -> super::Result<usize> {
220
- self.0.read(buf)
221
- }
181
+ fn read(&mut self, buf: &mut [u8]) -> super::Result<usize> { self.0.read(buf) }
222
182
223
183
#[inline]
224
- fn read_exact(&mut self, buf: &mut [u8]) -> super::Result<()> {
225
- self.0.read_exact(buf)
226
- }
184
+ fn read_exact(&mut self, buf: &mut [u8]) -> super::Result<()> { self.0.read_exact(buf) }
227
185
}
228
186
229
187
impl<T: super::BufRead> super::BufRead for ToStd<T> {
230
188
#[inline]
231
- fn fill_buf(&mut self) -> super::Result<&[u8]> {
232
- self.0.fill_buf()
233
- }
189
+ fn fill_buf(&mut self) -> super::Result<&[u8]> { self.0.fill_buf() }
234
190
235
191
#[inline]
236
- fn consume(&mut self, amount: usize) {
237
- self.0.consume(amount)
238
- }
192
+ fn consume(&mut self, amount: usize) { self.0.consume(amount) }
239
193
}
240
194
241
195
impl<T: super::Write> super::Write for ToStd<T> {
242
196
#[inline]
243
- fn write(&mut self, buf: &[u8]) -> super::Result<usize> {
244
- self.0.write(buf)
245
- }
197
+ fn write(&mut self, buf: &[u8]) -> super::Result<usize> { self.0.write(buf) }
246
198
247
199
#[inline]
248
- fn flush(&mut self) -> super::Result<()> {
249
- self.0.flush()
250
- }
200
+ fn flush(&mut self) -> super::Result<()> { self.0.flush() }
251
201
252
202
#[inline]
253
- fn write_all(&mut self, buf: &[u8]) -> super::Result<()> {
254
- self.0.write_all(buf)
255
- }
203
+ fn write_all(&mut self, buf: &[u8]) -> super::Result<()> { self.0.write_all(buf) }
256
204
}
257
205
258
206
macro_rules! impl_our {
0 commit comments