Guest User

Untitled

a guest
Dec 13th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. use itertools::{Itertools, MinMaxResult::MinMax};
  2. use std::mem::swap;
  3.  
  4. fn swap_hi_lo(v: &mut [u8]) {
  5. if let MinMax(lo, hi) = v.iter_mut().minmax() {
  6. swap(lo, hi);
  7. }
  8. }
  9.  
  10. fn main() {
  11. let mut rgb = [0, 255, 128];
  12. swap_hi_lo(&mut rgb);
  13. println!("{:?}", rgb);
  14. }
Add Comment
Please, Sign In to add comment