Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. fn main() {
  2. let b = vec![0u32, 1, 2, 3];
  3. let a = b.into_iter()
  4. .map(|x: u32| x.to_ne_bytes())
  5. .flat_map(|x: [u8; 4]| {
  6. let [x, y, z, w] = x;
  7. use std::iter::once;
  8. once(x).chain(once(y)).chain(once(z)).chain(once(w))
  9. })
  10. .collect::<Vec<u8>>();
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement