pub fn _load_versioned(bytes: &[u8]) -> Result<VersionedMappings, Error> {
    let mut cursor = Cursor::new(bytes);

    let header = read_header(&mut cursor)?;

    if header.is_native {
        return Err(MappingsError::MismatchedHeader.into());
    }

    // Load blocks
    let len = cursor.read_u32::<LittleEndian>()?;
    let mut blocks = HashMap::new();

    for _ in 0..len {
        let native_id = cursor.read_u16::<LittleEndian>()?;
        let versioned_id = cursor.read_u16::<LittleEndian>()?;
        blocks.insert(native_id, versioned_id);
    }

    Ok(VersionedMappings {
        version: header.version,
        proto: header.proto,
        blocks,
    })
}
/// Loads a versioned mappings file.
Loads a versioned mappings file.
Loads a versioned mappings file .
pub fn _load_versioned(bytes: &[u8]) -> Result<VersionedMappings, Error> {
    let mut cursor = Cursor::new(bytes);
    let header = read_header(&mut cursor)?;
    if header.is_native {
        return Err(MappingsError::MismatchedHeader.into());
    }
    // Load blocks
    let len = cursor.read_u32::<LittleEndian>()?;
    let mut blocks = HashMap::new();
    for _ in 0..len {
        let native_id = cursor.read_u16::<LittleEndian>()?;
        let versioned_id = cursor.read_u16::<LittleEndian>()?;
        blocks.insert(native_id, versioned_id);
    }
    Ok(VersionedMappings {
        version: header.version,
        proto: header.proto,
        blocks,
    })
}
pub fn _load_versioned ( bytes : & [ u8 ] ) -> Result < VersionedMappings , Error > { let mut cursor = Cursor :: new ( bytes ) ; let header = read_header ( & mut cursor ) ? ; if header . is_native { return Err ( MappingsError :: MismatchedHeader . into ( ) ) ; } // Load blocks let len = cursor . read_u32 :: < LittleEndian > ( ) ? ; let mut blocks = HashMap :: new ( ) ; for _ in 0 .. len { let native_id = cursor . read_u16 :: < LittleEndian > ( ) ? ; let versioned_id = cursor . read_u16 :: < LittleEndian > ( ) ? ; blocks . insert ( native_id , versioned_id ) ; } Ok ( VersionedMappings { version : header . version , proto : header . proto , blocks , } ) }
Loads a versioned mappings file.
Loads a versioned mappings file .
bytes
&[u8]
bytes
&[u8]