I've read a file into vector of unsigned bytes:
let data = fs::read("test.bin").expect("Unable to read file");
How can I convert/cast this vector to a Vec<u64>
, with every eight bytes constituting a u64?
The "duplicates" do not provide a solution, but I found it in the meanwhile:
let vec8: Vec<u8> = vec![1,2,3,4,5,6,7,8];
let mut vec64: Vec<u64> = vec![0;vec8.len()/8];
BigEndian::read_u64_into(&data, &mut vec64);