rust/tests/run-pass/aligned_utf8_check.rs
2019-09-17 11:47:36 -05:00

7 lines
237 B
Rust

fn main() {
const N: usize = 10;
let vec = vec![0x4141414141414141u64; N];
let content = unsafe { std::slice::from_raw_parts(vec.as_ptr() as *const u8, 8 * N) };
println!("{:?}", std::str::from_utf8(content).unwrap());
}