1use std::hash::Hash;
10use std::intrinsics;
11use std::marker::{DiscriminantKind, PointeeSized};
12
13use rustc_abi::FieldIdx;
14use rustc_data_structures::fx::FxHashMap;
15use rustc_hir::def_id::LocalDefId;
16use rustc_middle::ty::Const;
17use rustc_serialize::{Decodable, Encodable};
18use rustc_span::source_map::Spanned;
19use rustc_span::{Span, SpanDecoder, SpanEncoder};
20
21use crate::arena::ArenaAllocatable;
22use crate::infer::canonical::{CanonicalVarKind, CanonicalVarKinds};
23use crate::mir::interpret::{AllocId, ConstAllocation, CtfeProvenance};
24use crate::mir::mono::MonoItem;
25use crate::ty::{self, AdtDef, GenericArgsRef, Ty, TyCtxt};
26use crate::{mir, traits};
27
28pub const SHORTHAND_OFFSET: usize = 0x80;
32
33pub trait TyEncoder<'tcx>: SpanEncoder {
34 const CLEAR_CROSS_CRATE: bool;
35
36 fn position(&self) -> usize;
37
38 fn type_shorthands(&mut self) -> &mut FxHashMap<Ty<'tcx>, usize>;
39
40 fn predicate_shorthands(&mut self) -> &mut FxHashMap<ty::PredicateKind<'tcx>, usize>;
41
42 fn encode_alloc_id(&mut self, alloc_id: &AllocId);
43}
44
45pub trait TyDecoder<'tcx>: SpanDecoder {
46 const CLEAR_CROSS_CRATE: bool;
47
48 fn interner(&self) -> TyCtxt<'tcx>;
49
50 fn cached_ty_for_shorthand<F>(&mut self, shorthand: usize, or_insert_with: F) -> Ty<'tcx>
51 where
52 F: FnOnce(&mut Self) -> Ty<'tcx>;
53
54 fn with_position<F, R>(&mut self, pos: usize, f: F) -> R
55 where
56 F: FnOnce(&mut Self) -> R;
57
58 fn positioned_at_shorthand(&self) -> bool {
59 (self.peek_byte() & (SHORTHAND_OFFSET as u8)) != 0
60 }
61
62 fn decode_alloc_id(&mut self) -> AllocId;
63}
64
65pub trait EncodableWithShorthand<'tcx, E: TyEncoder<'tcx>>: Copy + Eq + Hash {
66 type Variant: Encodable<E>;
67 fn variant(&self) -> &Self::Variant;
68}
69
70#[allow(rustc::usage_of_ty_tykind)]
71impl<'tcx, E: TyEncoder<'tcx>> EncodableWithShorthand<'tcx, E> for Ty<'tcx> {
72 type Variant = ty::TyKind<'tcx>;
73
74 #[inline]
75 fn variant(&self) -> &Self::Variant {
76 self.kind()
77 }
78}
79
80impl<'tcx, E: TyEncoder<'tcx>> EncodableWithShorthand<'tcx, E> for ty::PredicateKind<'tcx> {
81 type Variant = ty::PredicateKind<'tcx>;
82
83 #[inline]
84 fn variant(&self) -> &Self::Variant {
85 self
86 }
87}
88
89pub trait RefDecodable<'tcx, D: TyDecoder<'tcx>>: PointeeSized {
100 fn decode(d: &mut D) -> &'tcx Self;
101}
102
103pub fn encode_with_shorthand<'tcx, E, T, M>(encoder: &mut E, value: &T, cache: M)
105where
106 E: TyEncoder<'tcx>,
107 M: for<'b> Fn(&'b mut E) -> &'b mut FxHashMap<T, usize>,
108 T: EncodableWithShorthand<'tcx, E>,
109 T::Variant: DiscriminantKind<Discriminant = isize>,
111{
112 let existing_shorthand = cache(encoder).get(value).copied();
113 if let Some(shorthand) = existing_shorthand {
114 encoder.emit_usize(shorthand);
115 return;
116 }
117
118 let variant = value.variant();
119
120 let start = encoder.position();
121 variant.encode(encoder);
122 let len = encoder.position() - start;
123
124 let discriminant = intrinsics::discriminant_value(variant);
127 if !(SHORTHAND_OFFSET > discriminant as usize) {
::core::panicking::panic("assertion failed: SHORTHAND_OFFSET > discriminant as usize")
};assert!(SHORTHAND_OFFSET > discriminant as usize);
128
129 let shorthand = start + SHORTHAND_OFFSET;
130
131 let leb128_bits = len * 7;
134
135 if leb128_bits >= 64 || (shorthand as u64) < (1 << leb128_bits) {
138 cache(encoder).insert(*value, shorthand);
139 }
140}
141
142impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for Ty<'tcx> {
143 fn encode(&self, e: &mut E) {
144 encode_with_shorthand(e, self, TyEncoder::type_shorthands);
145 }
146}
147
148impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for ty::Predicate<'tcx> {
149 fn encode(&self, e: &mut E) {
150 let kind = self.kind();
151 kind.bound_vars().encode(e);
152 encode_with_shorthand(e, &kind.skip_binder(), TyEncoder::predicate_shorthands);
153 }
154}
155
156impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for ty::Clause<'tcx> {
157 fn encode(&self, e: &mut E) {
158 self.as_predicate().encode(e);
159 }
160}
161
162impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for ty::Region<'tcx> {
163 fn encode(&self, e: &mut E) {
164 self.kind().encode(e);
165 }
166}
167
168impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for ty::Const<'tcx> {
169 fn encode(&self, e: &mut E) {
170 self.0.0.encode(e);
171 }
172}
173
174impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for ty::Pattern<'tcx> {
175 fn encode(&self, e: &mut E) {
176 self.0.0.encode(e);
177 }
178}
179
180impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for ty::ValTree<'tcx> {
181 fn encode(&self, e: &mut E) {
182 self.0.0.encode(e);
183 }
184}
185
186impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for ConstAllocation<'tcx> {
187 fn encode(&self, e: &mut E) {
188 self.inner().encode(e)
189 }
190}
191
192impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for AdtDef<'tcx> {
193 fn encode(&self, e: &mut E) {
194 self.0.0.encode(e)
195 }
196}
197
198impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for AllocId {
199 fn encode(&self, e: &mut E) {
200 e.encode_alloc_id(self)
201 }
202}
203
204impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for CtfeProvenance {
205 fn encode(&self, e: &mut E) {
206 self.into_parts().encode(e);
207 }
208}
209
210impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for ty::ParamEnv<'tcx> {
211 fn encode(&self, e: &mut E) {
212 self.caller_bounds().encode(e);
213 }
214}
215
216#[inline]
217fn decode_arena_allocable<'tcx, D: TyDecoder<'tcx>, T: ArenaAllocatable<'tcx> + Decodable<D>>(
218 decoder: &mut D,
219) -> &'tcx T {
220 decoder.interner().arena.alloc(Decodable::decode(decoder))
221}
222
223#[inline]
224fn decode_arena_allocable_slice<
225 'tcx,
226 D: TyDecoder<'tcx>,
227 T: ArenaAllocatable<'tcx> + Decodable<D>,
228>(
229 decoder: &mut D,
230) -> &'tcx [T] {
231 decoder.interner().arena.alloc_from_iter(<Vec<T> as Decodable<D>>::decode(decoder))
232}
233
234impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for Ty<'tcx> {
235 #[allow(rustc::usage_of_ty_tykind)]
236 fn decode(decoder: &mut D) -> Ty<'tcx> {
237 if decoder.positioned_at_shorthand() {
239 let pos = decoder.read_usize();
240 if !(pos >= SHORTHAND_OFFSET) {
::core::panicking::panic("assertion failed: pos >= SHORTHAND_OFFSET")
};assert!(pos >= SHORTHAND_OFFSET);
241 let shorthand = pos - SHORTHAND_OFFSET;
242
243 decoder.cached_ty_for_shorthand(shorthand, |decoder| {
244 decoder.with_position(shorthand, Ty::decode)
245 })
246 } else {
247 let tcx = decoder.interner();
248 tcx.mk_ty_from_kind(ty::TyKind::decode(decoder))
249 }
250 }
251}
252
253impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for ty::Predicate<'tcx> {
254 fn decode(decoder: &mut D) -> ty::Predicate<'tcx> {
255 let bound_vars = Decodable::decode(decoder);
256 let predicate_kind = ty::Binder::bind_with_vars(
258 if decoder.positioned_at_shorthand() {
259 let pos = decoder.read_usize();
260 if !(pos >= SHORTHAND_OFFSET) {
::core::panicking::panic("assertion failed: pos >= SHORTHAND_OFFSET")
};assert!(pos >= SHORTHAND_OFFSET);
261 let shorthand = pos - SHORTHAND_OFFSET;
262
263 decoder.with_position(shorthand, <ty::PredicateKind<'tcx> as Decodable<D>>::decode)
264 } else {
265 <ty::PredicateKind<'tcx> as Decodable<D>>::decode(decoder)
266 },
267 bound_vars,
268 );
269 decoder.interner().mk_predicate(predicate_kind)
270 }
271}
272
273impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for ty::Clause<'tcx> {
274 fn decode(decoder: &mut D) -> ty::Clause<'tcx> {
275 let pred: ty::Predicate<'tcx> = Decodable::decode(decoder);
276 pred.expect_clause()
277 }
278}
279
280impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for GenericArgsRef<'tcx> {
281 fn decode(decoder: &mut D) -> Self {
282 let len = decoder.read_usize();
283 let tcx = decoder.interner();
284 tcx.mk_args_from_iter(
285 (0..len).map::<ty::GenericArg<'tcx>, _>(|_| Decodable::decode(decoder)),
286 )
287 }
288}
289
290impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for mir::Place<'tcx> {
291 fn decode(decoder: &mut D) -> Self {
292 let local: mir::Local = Decodable::decode(decoder);
293 let len = decoder.read_usize();
294 let projection = decoder.interner().mk_place_elems_from_iter(
295 (0..len).map::<mir::PlaceElem<'tcx>, _>(|_| Decodable::decode(decoder)),
296 );
297 mir::Place { local, projection }
298 }
299}
300
301impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for ty::Region<'tcx> {
302 fn decode(decoder: &mut D) -> Self {
303 ty::Region::new_from_kind(decoder.interner(), Decodable::decode(decoder))
304 }
305}
306
307impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for CanonicalVarKinds<'tcx> {
308 fn decode(decoder: &mut D) -> Self {
309 let len = decoder.read_usize();
310 decoder.interner().mk_canonical_var_infos_from_iter(
311 (0..len).map::<CanonicalVarKind<'tcx>, _>(|_| Decodable::decode(decoder)),
312 )
313 }
314}
315
316impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for AllocId {
317 fn decode(decoder: &mut D) -> Self {
318 decoder.decode_alloc_id()
319 }
320}
321
322impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for CtfeProvenance {
323 fn decode(decoder: &mut D) -> Self {
324 let parts = Decodable::decode(decoder);
325 CtfeProvenance::from_parts(parts)
326 }
327}
328
329impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for ty::SymbolName<'tcx> {
330 fn decode(decoder: &mut D) -> Self {
331 ty::SymbolName::new(decoder.interner(), decoder.read_str())
332 }
333}
334
335impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for ty::ParamEnv<'tcx> {
336 fn decode(d: &mut D) -> Self {
337 let caller_bounds = Decodable::decode(d);
338 ty::ParamEnv::new(caller_bounds)
339 }
340}
341
342macro_rules! impl_decodable_via_ref {
343 ($($t:ty,)+) => {
344 $(impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for $t {
345 fn decode(decoder: &mut D) -> Self {
346 RefDecodable::decode(decoder)
347 }
348 })*
349 }
350}
351
352impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::List<Ty<'tcx>> {
353 fn decode(decoder: &mut D) -> &'tcx Self {
354 let len = decoder.read_usize();
355 decoder
356 .interner()
357 .mk_type_list_from_iter((0..len).map::<Ty<'tcx>, _>(|_| Decodable::decode(decoder)))
358 }
359}
360
361impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D>
362 for ty::List<ty::PolyExistentialPredicate<'tcx>>
363{
364 fn decode(decoder: &mut D) -> &'tcx Self {
365 let len = decoder.read_usize();
366 decoder.interner().mk_poly_existential_predicates_from_iter(
367 (0..len).map::<ty::Binder<'tcx, _>, _>(|_| Decodable::decode(decoder)),
368 )
369 }
370}
371
372impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for ty::Const<'tcx> {
373 fn decode(decoder: &mut D) -> Self {
374 let kind: ty::ConstKind<'tcx> = Decodable::decode(decoder);
375 decoder.interner().mk_ct_from_kind(kind)
376 }
377}
378
379impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for ty::Pattern<'tcx> {
380 fn decode(decoder: &mut D) -> Self {
381 decoder.interner().mk_pat(Decodable::decode(decoder))
382 }
383}
384
385impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for ty::ValTree<'tcx> {
386 fn decode(decoder: &mut D) -> Self {
387 decoder.interner().intern_valtree(Decodable::decode(decoder))
388 }
389}
390
391impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for ConstAllocation<'tcx> {
392 fn decode(decoder: &mut D) -> Self {
393 decoder.interner().mk_const_alloc(Decodable::decode(decoder))
394 }
395}
396
397impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for AdtDef<'tcx> {
398 fn decode(decoder: &mut D) -> Self {
399 decoder.interner().mk_adt_def_from_data(Decodable::decode(decoder))
400 }
401}
402
403impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [(ty::Clause<'tcx>, Span)] {
404 fn decode(decoder: &mut D) -> &'tcx Self {
405 decoder
406 .interner()
407 .arena
408 .alloc_from_iter((0..decoder.read_usize()).map(|_| Decodable::decode(decoder)))
409 }
410}
411
412impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [(ty::PolyTraitRef<'tcx>, Span)] {
413 fn decode(decoder: &mut D) -> &'tcx Self {
414 decoder
415 .interner()
416 .arena
417 .alloc_from_iter((0..decoder.read_usize()).map(|_| Decodable::decode(decoder)))
418 }
419}
420
421impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [Spanned<MonoItem<'tcx>>] {
422 fn decode(decoder: &mut D) -> &'tcx Self {
423 decoder
424 .interner()
425 .arena
426 .alloc_from_iter((0..decoder.read_usize()).map(|_| Decodable::decode(decoder)))
427 }
428}
429
430impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::List<ty::BoundVariableKind<'tcx>> {
431 fn decode(decoder: &mut D) -> &'tcx Self {
432 let len = decoder.read_usize();
433 decoder.interner().mk_bound_variable_kinds_from_iter(
434 (0..len).map::<ty::BoundVariableKind<'tcx>, _>(|_| Decodable::decode(decoder)),
435 )
436 }
437}
438
439impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::List<ty::Pattern<'tcx>> {
440 fn decode(decoder: &mut D) -> &'tcx Self {
441 let len = decoder.read_usize();
442 decoder.interner().mk_patterns_from_iter(
443 (0..len).map::<ty::Pattern<'tcx>, _>(|_| Decodable::decode(decoder)),
444 )
445 }
446}
447
448impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::List<ty::Const<'tcx>> {
449 fn decode(decoder: &mut D) -> &'tcx Self {
450 let len = decoder.read_usize();
451 decoder.interner().mk_const_list_from_iter(
452 (0..len).map::<ty::Const<'tcx>, _>(|_| Decodable::decode(decoder)),
453 )
454 }
455}
456
457impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D>
458 for ty::ListWithCachedTypeInfo<ty::Clause<'tcx>>
459{
460 fn decode(decoder: &mut D) -> &'tcx Self {
461 let len = decoder.read_usize();
462 decoder.interner().mk_clauses_from_iter(
463 (0..len).map::<ty::Clause<'tcx>, _>(|_| Decodable::decode(decoder)),
464 )
465 }
466}
467
468impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::List<FieldIdx> {
469 fn decode(decoder: &mut D) -> &'tcx Self {
470 let len = decoder.read_usize();
471 decoder
472 .interner()
473 .mk_fields_from_iter((0..len).map::<FieldIdx, _>(|_| Decodable::decode(decoder)))
474 }
475}
476
477impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::List<LocalDefId> {
478 fn decode(decoder: &mut D) -> &'tcx Self {
479 let len = decoder.read_usize();
480 decoder.interner().mk_local_def_ids_from_iter(
481 (0..len).map::<LocalDefId, _>(|_| Decodable::decode(decoder)),
482 )
483 }
484}
485
486impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for &'tcx ty::List<LocalDefId> {
487 fn decode(d: &mut D) -> Self {
488 RefDecodable::decode(d)
489 }
490}
491
492impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for &'tcx ty::List<Const<'tcx>> {
fn decode(decoder: &mut D) -> Self { RefDecodable::decode(decoder) }
}impl_decodable_via_ref! {
493 &'tcx ty::TypeckResults<'tcx>,
494 &'tcx ty::List<Ty<'tcx>>,
495 &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
496 &'tcx traits::ImplSource<'tcx, ()>,
497 &'tcx mir::Body<'tcx>,
498 &'tcx ty::List<ty::BoundVariableKind<'tcx>>,
499 &'tcx ty::List<ty::Pattern<'tcx>>,
500 &'tcx ty::ListWithCachedTypeInfo<ty::Clause<'tcx>>,
501 &'tcx ty::List<Const<'tcx>>,
502}
503
504#[macro_export]
505macro_rules! __impl_decoder_methods {
506 ($($name:ident -> $ty:ty;)*) => {
507 $(
508 #[inline]
509 fn $name(&mut self) -> $ty {
510 self.opaque.$name()
511 }
512 )*
513 }
514}
515
516macro_rules! impl_arena_allocatable_decoder {
517 ([]$args:tt) => {};
518 ([decode $(, $attrs:ident)*]
519 [$name:ident: $ty:ty]) => {
520 impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for $ty {
521 #[inline]
522 fn decode(decoder: &mut D) -> &'tcx Self {
523 decode_arena_allocable(decoder)
524 }
525 }
526
527 impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [$ty] {
528 #[inline]
529 fn decode(decoder: &mut D) -> &'tcx Self {
530 decode_arena_allocable_slice(decoder)
531 }
532 }
533 };
534}
535
536macro_rules! impl_arena_allocatable_decoders {
537 ([$($a:tt $name:ident: $ty:ty,)*]) => {
538 $(
539 impl_arena_allocatable_decoder!($a [$name: $ty]);
540 )*
541 }
542}
543
544rustc_hir::arena_types!(impl_arena_allocatable_decoders);
545impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for
rustc_ast::tokenstream::TokenStream {
#[inline]
fn decode(decoder: &mut D) -> &'tcx Self {
decode_arena_allocable(decoder)
}
}
impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for
[rustc_ast::tokenstream::TokenStream] {
#[inline]
fn decode(decoder: &mut D) -> &'tcx Self {
decode_arena_allocable_slice(decoder)
}
}arena_types!(impl_arena_allocatable_decoders);
546
547macro_rules! impl_arena_copy_decoder {
548 (<$tcx:tt> $($ty:ty,)*) => {
549 $(impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for $ty {
550 #[inline]
551 fn decode(decoder: &mut D) -> &'tcx Self {
552 decoder.interner().arena.alloc(Decodable::decode(decoder))
553 }
554 }
555
556 impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [$ty] {
557 #[inline]
558 fn decode(decoder: &mut D) -> &'tcx Self {
559 decoder.interner().arena.alloc_from_iter(<Vec<_> as Decodable<D>>::decode(decoder))
560 }
561 })*
562 };
563}
564
565impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for
rustc_middle::middle::deduced_param_attrs::DeducedParamAttrs {
#[inline]
fn decode(decoder: &mut D) -> &'tcx Self {
decoder.interner().arena.alloc(Decodable::decode(decoder))
}
}
impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for
[rustc_middle::middle::deduced_param_attrs::DeducedParamAttrs] {
#[inline]
fn decode(decoder: &mut D) -> &'tcx Self {
decoder.interner().arena.alloc_from_iter(<Vec<_> as
Decodable<D>>::decode(decoder))
}
}impl_arena_copy_decoder! {<'tcx>
566 Span,
567 rustc_span::Ident,
568 ty::Variance,
569 rustc_span::def_id::DefId,
570 rustc_span::def_id::LocalDefId,
571 (rustc_middle::middle::exported_symbols::ExportedSymbol<'tcx>, rustc_middle::middle::exported_symbols::SymbolExportInfo),
572 rustc_middle::middle::deduced_param_attrs::DeducedParamAttrs,
573}
574
575#[macro_export]
576macro_rules! implement_ty_decoder {
577 ($DecoderName:ident <$($typaram:tt),*>) => {
578 mod __ty_decoder_impl {
579 use rustc_serialize::Decoder;
580
581 use super::$DecoderName;
582
583 impl<$($typaram ),*> Decoder for $DecoderName<$($typaram),*> {
584 $crate::__impl_decoder_methods! {
585 read_usize -> usize;
586 read_u128 -> u128;
587 read_u64 -> u64;
588 read_u32 -> u32;
589 read_u16 -> u16;
590 read_u8 -> u8;
591
592 read_isize -> isize;
593 read_i128 -> i128;
594 read_i64 -> i64;
595 read_i32 -> i32;
596 read_i16 -> i16;
597 }
598
599 #[inline]
600 fn read_raw_bytes(&mut self, len: usize) -> &[u8] {
601 self.opaque.read_raw_bytes(len)
602 }
603
604 #[inline]
605 fn peek_byte(&self) -> u8 {
606 self.opaque.peek_byte()
607 }
608
609 #[inline]
610 fn position(&self) -> usize {
611 self.opaque.position()
612 }
613 }
614 }
615 }
616}