Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use itertools::{Itertools, MinMaxResult::MinMax};
- use std::mem::swap;
- fn swap_hi_lo(v: &mut [u8]) {
- if let MinMax(lo, hi) = v.iter_mut().minmax() {
- swap(lo, hi);
- }
- }
- fn main() {
- let mut rgb = [0, 255, 128];
- swap_hi_lo(&mut rgb);
- println!("{:?}", rgb);
- }
Add Comment
Please, Sign In to add comment