This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{cmp::Ordering, iter}; | |
| use itertools::Itertools; | |
| pub fn natural_string_cmp(a: &str, b: &str) -> Ordering { | |
| let mut a_chars_iter = a.chars().peekable(); | |
| let mut b_chars_iter = b.chars().peekable(); | |
| loop { | |
| match (a_chars_iter.next(), b_chars_iter.next()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use image::{Rgba, ImageBuffer}; | |
| const MAX_COLOR_MAP_SIZE: u32 = 256; | |
| type PixelColor = Rgba<u8>; | |
| type Image = ImageBuffer<PixelColor, Vec<u8>>; | |
| pub struct ImageQuantization { | |
| pub palette: Vec<PixelColor>, | |
| pub indices: Vec<u8>, |