pub fn new(sess: &'sess Session, data: Vec<u8>, start_pos: usize) -> OnDiskCache<'sess> {
        debug_assert!(sess.opts.incremental.is_some());

        // Wrapping in a scope so we can borrow `data`
        let footer: Footer = {
            let mut decoder = opaque::Decoder::new(&data[..], start_pos);

            // Decode the *position* of the footer which can be found in the
            // last 8 bytes of the file.
            decoder.set_position(data.len() - IntEncodedWithFixedSize::ENCODED_SIZE);
            let query_result_index_pos = IntEncodedWithFixedSize::decode(&mut decoder)
                .expect("Error while trying to decode query result index position.")
                .0 as usize;

            // Decoder the file footer which contains all the lookup tables, etc.
            decoder.set_position(query_result_index_pos);
            decode_tagged(&mut decoder, TAG_FILE_FOOTER)
                .expect("Error while trying to decode query result index position.")
        };

        OnDiskCache {
            serialized_data: data,
            file_index_to_stable_id: footer.file_index_to_stable_id,
            file_index_to_file: Lock::new(FxHashMap()),
            prev_cnums: footer.prev_cnums,
            cnum_map: Once::new(),
            codemap: sess.codemap(),
            current_diagnostics: Lock::new(FxHashMap()),
            query_result_index: footer.query_result_index.into_iter().collect(),
            prev_diagnostics_index: footer.diagnostics_index.into_iter().collect(),
            synthetic_expansion_infos: Lock::new(FxHashMap()),
            prev_interpret_alloc_index: footer.interpret_alloc_index,
            interpret_alloc_cache: RefCell::new(FxHashMap::default()),
        }
    }
/// Create a new OnDiskCache instance from the serialized data in `data`.
Create a new OnDiskCache instance from the serialized data in `data`.
Create a new OnDiskCache instance from the serialized data in ` data ` .
pub fn new(sess: &'sess Session, data: Vec<u8>, start_pos: usize) -> OnDiskCache<'sess> {
        debug_assert!(sess.opts.incremental.is_some());
        // Wrapping in a scope so we can borrow `data`
        let footer: Footer = {
            let mut decoder = opaque::Decoder::new(&data[..], start_pos);
            // Decode the *position* of the footer which can be found in the
            // last 8 bytes of the file.
            decoder.set_position(data.len() - IntEncodedWithFixedSize::ENCODED_SIZE);
            let query_result_index_pos = IntEncodedWithFixedSize::decode(&mut decoder)
                .expect("Error while trying to decode query result index position.")
                .0 as usize;
            // Decoder the file footer which contains all the lookup tables, etc.
            decoder.set_position(query_result_index_pos);
            decode_tagged(&mut decoder, TAG_FILE_FOOTER)
                .expect("Error while trying to decode query result index position.")
        };
        OnDiskCache {
            serialized_data: data,
            file_index_to_stable_id: footer.file_index_to_stable_id,
            file_index_to_file: Lock::new(FxHashMap()),
            prev_cnums: footer.prev_cnums,
            cnum_map: Once::new(),
            codemap: sess.codemap(),
            current_diagnostics: Lock::new(FxHashMap()),
            query_result_index: footer.query_result_index.into_iter().collect(),
            prev_diagnostics_index: footer.diagnostics_index.into_iter().collect(),
            synthetic_expansion_infos: Lock::new(FxHashMap()),
            prev_interpret_alloc_index: footer.interpret_alloc_index,
            interpret_alloc_cache: RefCell::new(FxHashMap::default()),
        }
    }
pub fn new ( sess : & ' sess Session , data : Vec < u8 > , start_pos : usize ) -> OnDiskCache < ' sess > { debug_assert ! ( sess opts incremental is_some ( ) ) ; // Wrapping in a scope so we can borrow `data` let footer : Footer = { let mut decoder = opaque :: Decoder :: new ( & data [ .. ] , start_pos ) ; // Decode the *position* of the footer which can be found in the // last 8 bytes of the file. decoder . set_position ( data . len ( ) - IntEncodedWithFixedSize :: ENCODED_SIZE ) ; let query_result_index_pos = IntEncodedWithFixedSize :: decode ( & mut decoder ) . expect ( " " ) . 0 as usize ; // Decoder the file footer which contains all the lookup tables, etc. decoder . set_position ( query_result_index_pos ) ; decode_tagged ( & mut decoder , TAG_FILE_FOOTER ) . expect ( " " ) } ; OnDiskCache { serialized_data : data , file_index_to_stable_id : footer . file_index_to_stable_id , file_index_to_file : Lock :: new ( FxHashMap ( ) ) , prev_cnums : footer . prev_cnums , cnum_map : Once :: new ( ) , codemap : sess . codemap ( ) , current_diagnostics : Lock :: new ( FxHashMap ( ) ) , query_result_index : footer . query_result_index . into_iter ( ) . collect ( ) , prev_diagnostics_index : footer . diagnostics_index . into_iter ( ) . collect ( ) , synthetic_expansion_infos : Lock :: new ( FxHashMap ( ) ) , prev_interpret_alloc_index : footer . interpret_alloc_index , interpret_alloc_cache : RefCell :: new ( FxHashMap :: default ( ) ) , } }
Create a new OnDiskCache instance from the serialized data in `data`.
Create a new OnDiskCache instance from the serialized data in ` data ` .
sess
&'sess Session
data
Vec<u8>
start_pos
usize