pub fn read_spir_v_file<P: AsRef<Path>>(file: P) -> VdResult<Vec<u32>> {
    let contents = read_file(file)?;
    assert!(contents.len() % 4 == 0);
    assert!(mem::size_of_val(&contents[0]) == 1);
    // TODO: Add some sort of basic verification that the file is actually
    // spir-v.
    unsafe {
        let ptr = contents.as_ptr() as *const u32;
        let new_len = contents.len() / 4;
        let slice: &[u32] = slice::from_raw_parts(ptr, new_len);
        let vec = slice.to_vec();
        Ok(vec)
    }
}
/// Reads a SPIR-V file into a word Vec.
Reads a SPIR-V file into a word Vec.
Reads a SPIR - V file into a word Vec .
pub fn read_spir_v_file<P: AsRef<Path>>(file: P) -> VdResult<Vec<u32>> {
    let contents = read_file(file)?;
    assert!(contents.len() % 4 == 0);
    assert!(mem::size_of_val(&contents[0]) == 1);
    // TODO: Add some sort of basic verification that the file is actually
    // spir-v.
    unsafe {
        let ptr = contents.as_ptr() as *const u32;
        let new_len = contents.len() / 4;
        let slice: &[u32] = slice::from_raw_parts(ptr, new_len);
        let vec = slice.to_vec();
        Ok(vec)
    }
}
pub fn read_spir_v_file < P : AsRef < Path > > ( file : P ) -> VdResult < Vec < u32 > > { let contents = read_file ( file ) ? ; assert ! ( contents len ( ) 4 0 ) ; assert ! ( mem size_of_val ( contents [ 0 ] ) 1 ) ; // TODO: Add some sort of basic verification that the file is actually // spir-v. unsafe { let ptr = contents . as_ptr ( ) as * const u32 ; let new_len = contents . len ( ) / 4 ; let slice : & [ u32 ] = slice :: from_raw_parts ( ptr , new_len ) ; let vec = slice . to_vec ( ) ; Ok ( vec ) } }
Reads a SPIR-V file into a word Vec.
Reads a SPIR - V file into a word Vec .
file
P
file
P