1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#[derive(Debug, Clone)] pub struct Buffer { pub width: f32, pub height: f32, pub palette: Vec<char>, } impl Buffer { pub fn from_height(height: f32, aspect_ratio: f32) -> Self { Self { height, width: height * aspect_ratio, palette: "$@B%8&WM#oahkbdpqwmZO0QLCJUYXzcvunxrjft/\\|()1{}[]?-_+~<>i!lI;:,\"^`'. " .chars() .collect(), } } }