@@ -179,74 +179,90 @@ macro_rules! read_sleb128 {
179
179
impl < ' a > serialize:: Decoder for Decoder < ' a > {
180
180
type Error = String ;
181
181
182
+ #[ inline]
182
183
fn read_nil ( & mut self ) -> Result < ( ) , Self :: Error > {
183
184
Ok ( ( ) )
184
185
}
185
186
187
+ #[ inline]
186
188
fn read_u64 ( & mut self ) -> Result < u64 , Self :: Error > {
187
189
read_uleb128 ! ( self , u64 )
188
190
}
189
191
192
+ #[ inline]
190
193
fn read_u32 ( & mut self ) -> Result < u32 , Self :: Error > {
191
194
read_uleb128 ! ( self , u32 )
192
195
}
193
196
197
+ #[ inline]
194
198
fn read_u16 ( & mut self ) -> Result < u16 , Self :: Error > {
195
199
read_uleb128 ! ( self , u16 )
196
200
}
197
201
202
+ #[ inline]
198
203
fn read_u8 ( & mut self ) -> Result < u8 , Self :: Error > {
199
204
let value = self . data [ self . position ] ;
200
205
self . position += 1 ;
201
206
Ok ( value)
202
207
}
203
208
209
+ #[ inline]
204
210
fn read_usize ( & mut self ) -> Result < usize , Self :: Error > {
205
211
read_uleb128 ! ( self , usize )
206
212
}
207
213
214
+ #[ inline]
208
215
fn read_i64 ( & mut self ) -> Result < i64 , Self :: Error > {
209
216
read_sleb128 ! ( self , i64 )
210
217
}
211
218
219
+ #[ inline]
212
220
fn read_i32 ( & mut self ) -> Result < i32 , Self :: Error > {
213
221
read_sleb128 ! ( self , i32 )
214
222
}
215
223
224
+ #[ inline]
216
225
fn read_i16 ( & mut self ) -> Result < i16 , Self :: Error > {
217
226
read_sleb128 ! ( self , i16 )
218
227
}
219
228
229
+ #[ inline]
220
230
fn read_i8 ( & mut self ) -> Result < i8 , Self :: Error > {
221
231
let as_u8 = self . data [ self . position ] ;
222
232
self . position += 1 ;
223
233
unsafe { Ok ( :: std:: mem:: transmute ( as_u8) ) }
224
234
}
225
235
236
+ #[ inline]
226
237
fn read_isize ( & mut self ) -> Result < isize , Self :: Error > {
227
238
read_sleb128 ! ( self , isize )
228
239
}
229
240
241
+ #[ inline]
230
242
fn read_bool ( & mut self ) -> Result < bool , Self :: Error > {
231
243
let value = self . read_u8 ( ) ?;
232
244
Ok ( value != 0 )
233
245
}
234
246
247
+ #[ inline]
235
248
fn read_f64 ( & mut self ) -> Result < f64 , Self :: Error > {
236
249
let bits = self . read_u64 ( ) ?;
237
250
Ok ( unsafe { :: std:: mem:: transmute ( bits) } )
238
251
}
239
252
253
+ #[ inline]
240
254
fn read_f32 ( & mut self ) -> Result < f32 , Self :: Error > {
241
255
let bits = self . read_u32 ( ) ?;
242
256
Ok ( unsafe { :: std:: mem:: transmute ( bits) } )
243
257
}
244
258
259
+ #[ inline]
245
260
fn read_char ( & mut self ) -> Result < char , Self :: Error > {
246
261
let bits = self . read_u32 ( ) ?;
247
262
Ok ( :: std:: char:: from_u32 ( bits) . unwrap ( ) )
248
263
}
249
264
265
+ #[ inline]
250
266
fn read_str ( & mut self ) -> Result < Cow < str > , Self :: Error > {
251
267
let len = self . read_usize ( ) ?;
252
268
let s = :: std:: str:: from_utf8 ( & self . data [ self . position ..self . position + len] ) . unwrap ( ) ;
0 commit comments