Struct rustc_query_impl::on_disk_cache::CacheEncoder
source · [−]pub struct CacheEncoder<'a, 'tcx, E: OpaqueEncoder> {
tcx: TyCtxt<'tcx>,
encoder: &'a mut E,
type_shorthands: FxHashMap<Ty<'tcx>, usize>,
predicate_shorthands: FxHashMap<PredicateKind<'tcx>, usize>,
interpret_allocs: FxIndexSet<AllocId>,
source_map: CachingSourceMapView<'tcx>,
file_to_file_index: FxHashMap<*const SourceFile, SourceFileIndex>,
hygiene_context: &'a HygieneEncodeContext,
}Expand description
An encoder that can write to the incremental compilation cache.
Fields
tcx: TyCtxt<'tcx>encoder: &'a mut Etype_shorthands: FxHashMap<Ty<'tcx>, usize>predicate_shorthands: FxHashMap<PredicateKind<'tcx>, usize>interpret_allocs: FxIndexSet<AllocId>source_map: CachingSourceMapView<'tcx>file_to_file_index: FxHashMap<*const SourceFile, SourceFileIndex>hygiene_context: &'a HygieneEncodeContextImplementations
sourceimpl<'a, 'tcx, E> CacheEncoder<'a, 'tcx, E> where
E: 'a + OpaqueEncoder,
impl<'a, 'tcx, E> CacheEncoder<'a, 'tcx, E> where
E: 'a + OpaqueEncoder,
fn source_file_index(&mut self, source_file: Lrc<SourceFile>) -> SourceFileIndex
sourcefn encode_tagged<T: Encodable<Self>, V: Encodable<Self>>(
&mut self,
tag: T,
value: &V
) -> Result<(), E::Error>
fn encode_tagged<T: Encodable<Self>, V: Encodable<Self>>(
&mut self,
tag: T,
value: &V
) -> Result<(), E::Error>
Encode something with additional information that allows to do some sanity checks when decoding the data again. This method will first encode the specified tag, then the given value, then the number of bytes taken up by tag and value. On decoding, we can then verify that we get the expected tag and read the expected number of bytes.
Trait Implementations
sourceimpl<'a, 'tcx, E> Encodable<CacheEncoder<'a, 'tcx, E>> for SyntaxContext where
E: 'a + OpaqueEncoder,
impl<'a, 'tcx, E> Encodable<CacheEncoder<'a, 'tcx, E>> for SyntaxContext where
E: 'a + OpaqueEncoder,
sourceimpl<'a, 'tcx, E> Encodable<CacheEncoder<'a, 'tcx, E>> for ExpnId where
E: 'a + OpaqueEncoder,
impl<'a, 'tcx, E> Encodable<CacheEncoder<'a, 'tcx, E>> for ExpnId where
E: 'a + OpaqueEncoder,
sourceimpl<'a, 'tcx, E> Encodable<CacheEncoder<'a, 'tcx, E>> for Span where
E: 'a + OpaqueEncoder,
impl<'a, 'tcx, E> Encodable<CacheEncoder<'a, 'tcx, E>> for Span where
E: 'a + OpaqueEncoder,
sourceimpl<'a, 'tcx, E> Encodable<CacheEncoder<'a, 'tcx, E>> for CrateNum where
E: 'a + OpaqueEncoder,
impl<'a, 'tcx, E> Encodable<CacheEncoder<'a, 'tcx, E>> for CrateNum where
E: 'a + OpaqueEncoder,
sourceimpl<'a, 'tcx, E> Encodable<CacheEncoder<'a, 'tcx, E>> for DefId where
E: 'a + OpaqueEncoder,
impl<'a, 'tcx, E> Encodable<CacheEncoder<'a, 'tcx, E>> for DefId where
E: 'a + OpaqueEncoder,
sourceimpl<'a, 'tcx, E> Encodable<CacheEncoder<'a, 'tcx, E>> for DefIndex where
E: 'a + OpaqueEncoder,
impl<'a, 'tcx, E> Encodable<CacheEncoder<'a, 'tcx, E>> for DefIndex where
E: 'a + OpaqueEncoder,
sourceimpl<'a, 'tcx> Encodable<CacheEncoder<'a, 'tcx, FileEncoder>> for [u8]
impl<'a, 'tcx> Encodable<CacheEncoder<'a, 'tcx, FileEncoder>> for [u8]
fn encode(
&self,
e: &mut CacheEncoder<'a, 'tcx, FileEncoder>
) -> FileEncodeResult
sourceimpl<'a, 'tcx, E> Encoder for CacheEncoder<'a, 'tcx, E> where
E: 'a + OpaqueEncoder,
impl<'a, 'tcx, E> Encoder for CacheEncoder<'a, 'tcx, E> where
E: 'a + OpaqueEncoder,
type Error = E::Error
fn emit_unit(&mut self) -> Result<(), Self::Error>
fn emit_usize(&mut self, value: usize) -> Result<(), Self::Error>
fn emit_u128(&mut self, value: u128) -> Result<(), Self::Error>
fn emit_u64(&mut self, value: u64) -> Result<(), Self::Error>
fn emit_u32(&mut self, value: u32) -> Result<(), Self::Error>
fn emit_u16(&mut self, value: u16) -> Result<(), Self::Error>
fn emit_u8(&mut self, value: u8) -> Result<(), Self::Error>
fn emit_isize(&mut self, value: isize) -> Result<(), Self::Error>
fn emit_i128(&mut self, value: i128) -> Result<(), Self::Error>
fn emit_i64(&mut self, value: i64) -> Result<(), Self::Error>
fn emit_i32(&mut self, value: i32) -> Result<(), Self::Error>
fn emit_i16(&mut self, value: i16) -> Result<(), Self::Error>
fn emit_i8(&mut self, value: i8) -> Result<(), Self::Error>
fn emit_bool(&mut self, value: bool) -> Result<(), Self::Error>
fn emit_f64(&mut self, value: f64) -> Result<(), Self::Error>
fn emit_f32(&mut self, value: f32) -> Result<(), Self::Error>
fn emit_char(&mut self, value: char) -> Result<(), Self::Error>
fn emit_str(&mut self, value: &str) -> Result<(), Self::Error>
fn emit_raw_bytes(&mut self, value: &[u8]) -> Result<(), Self::Error>
fn emit_enum<F>(&mut self, f: F) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_enum_variant<F>(
&mut self,
_v_name: &str,
v_id: usize,
_len: usize,
f: F
) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_fieldless_enum_variant<const ID: usize>(
&mut self,
_v_name: &str
) -> Result<(), Self::Error>
fn emit_enum_variant_arg<F>(
&mut self,
_first: bool,
f: F
) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_struct<F>(&mut self, _no_fields: bool, f: F) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_struct_field<F>(
&mut self,
_f_name: &str,
_first: bool,
f: F
) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_tuple<F>(&mut self, _len: usize, f: F) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_tuple_arg<F>(&mut self, _idx: usize, f: F) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_option<F>(&mut self, f: F) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_option_none(&mut self) -> Result<(), Self::Error>
fn emit_option_some<F>(&mut self, f: F) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_seq<F>(&mut self, len: usize, f: F) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_seq_elt<F>(&mut self, _idx: usize, f: F) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_map<F>(&mut self, len: usize, f: F) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_map_elt_key<F>(&mut self, _idx: usize, f: F) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
fn emit_map_elt_val<F>(&mut self, f: F) -> Result<(), Self::Error> where
F: FnOnce(&mut Self) -> Result<(), Self::Error>,
sourceimpl<'a, 'tcx, E> TyEncoder<'tcx> for CacheEncoder<'a, 'tcx, E> where
E: 'a + OpaqueEncoder,
impl<'a, 'tcx, E> TyEncoder<'tcx> for CacheEncoder<'a, 'tcx, E> where
E: 'a + OpaqueEncoder,
const CLEAR_CROSS_CRATE: bool
fn position(&self) -> usize
fn type_shorthands(&mut self) -> &mut FxHashMap<Ty<'tcx>, usize>
fn predicate_shorthands(&mut self) -> &mut FxHashMap<PredicateKind<'tcx>, usize>
fn encode_alloc_id(&mut self, alloc_id: &AllocId) -> Result<(), Self::Error>
Auto Trait Implementations
impl<'a, 'tcx, E> !RefUnwindSafe for CacheEncoder<'a, 'tcx, E>
impl<'a, 'tcx, E> !Send for CacheEncoder<'a, 'tcx, E>
impl<'a, 'tcx, E> !Sync for CacheEncoder<'a, 'tcx, E>
impl<'a, 'tcx, E> Unpin for CacheEncoder<'a, 'tcx, E>
impl<'a, 'tcx, E> !UnwindSafe for CacheEncoder<'a, 'tcx, E>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 312 bytes