Skip to main content

Module codec

Module codec 

Source
Expand description

This module contains some shared code for encoding and decoding various things from the ty module, and in particular implements support for “shorthands” which allow to have pointers back into the already encoded stream instead of re-encoding the same thing twice.

The functionality in here is shared between persisting to crate metadata and persisting to incr. comp. caches.

Re-exports§

use std::hash::Hash; 🔒
use std::hash::Hash; 🔒
use std::intrinsics; 🔒 Experimental
use std::marker::DiscriminantKind; 🔒 Experimental
use rustc_data_structures::fx::FxHashMap; 🔒
use rustc_serialize::Decodable; 🔒
use rustc_serialize::Encodable; 🔒
use rustc_span::SpanDecoder; 🔒
use rustc_span::SpanEncoder; 🔒
pub use self::ref_decodable::RefDecodable;
use crate::infer::canonical::CanonicalVarKind; 🔒
use crate::infer::canonical::CanonicalVarKinds; 🔒
use crate::mir; 🔒
use crate::mir::interpret::AllocId; 🔒
use crate::mir::interpret::ConstAllocation; 🔒
use crate::mir::interpret::CtfeProvenance; 🔒
use crate::ty; 🔒
use crate::ty::AdtDef; 🔒
use crate::ty::GenericArgs; 🔒
use crate::ty::Ty; 🔒
use crate::ty::TyCtxt; 🔒

Modules§

ref_decodable 🔒

Macros§

forward_all_decoder_methods_to
Declares implementations of all Decoder methods, each of which forwards to a method of the same name on some underlying decoder, typically a field of type MemDecoder.

Constants§

SHORTHAND_OFFSET
The shorthand encoding uses an enum’s variant index usize and is offset by this value so it never matches a real variant. This offset is also chosen so that the first byte is never < 0x80.

Traits§

EncodableWithShorthand
TyDecoder
TyEncoder

Functions§

encode_with_shorthand
Encode the given value or a previously cached shorthand.