Vec
Rust
dimension
shift
buffer
vec
transmute
ptr
safe
unsafe
vec-dimension-shift
dimension_shift_buffer
published
dimension_shift_buffer https://crates.io/crates/dimension_shiftable_buffer https://github.com/usagi/dimension_shiftable_buffer https://docs.rs/dimension_shiftable_buffer/1.0.0/dimension_shiftable_buffer/ vec-dimension-shift https://crates.…
// for rust-1.27.2(stable) use std::mem; use std::io::Write; fn main() { { // f64 (primitive) -> Vec< u8 > let f = 1.0f64; let view = &f as *const _ as *const u8; let slice = unsafe { std::slice::from_raw_parts( view, mem::size_of::< f64 >…