Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let b = vec![0u32, 1, 2, 3];
- let a = b.into_iter()
- .map(|x: u32| x.to_ne_bytes())
- .flat_map(|x: [u8; 4]| {
- let [x, y, z, w] = x;
- use std::iter::once;
- once(x).chain(once(y)).chain(once(z)).chain(once(w))
- })
- .collect::<Vec<u8>>();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement