1 pub mod block { 2 pub const FULL: &str = "█"; 3 pub const SEVEN_EIGHTHS: &str = "▉"; 4 pub const THREE_QUARTERS: &str = "▊"; 5 pub const FIVE_EIGHTHS: &str = "▋"; 6 pub const HALF: &str = "▌"; 7 pub const THREE_EIGHTHS: &str = "▍"; 8 pub const ONE_QUARTER: &str = "▎"; 9 pub const ONE_EIGHTH: &str = "▏"; 10 11 #[derive(Debug, Clone)] 12 pub struct Set { 13 pub full: &'static str, 14 pub seven_eighths: &'static str, 15 pub three_quarters: &'static str, 16 pub five_eighths: &'static str, 17 pub half: &'static str, 18 pub three_eighths: &'static str, 19 pub one_quarter: &'static str, 20 pub one_eighth: &'static str, 21 pub empty: &'static str, 22 } 23 24 pub const THREE_LEVELS: Set = Set { 25 full: FULL, 26 seven_eighths: FULL, 27 three_quarters: HALF, 28 five_eighths: HALF, 29 half: HALF, 30 three_eighths: HALF, 31 one_quarter: HALF, 32 one_eighth: " ", 33 empty: " ", 34 }; 35 36 pub const NINE_LEVELS: Set = Set { 37 full: FULL, 38 seven_eighths: SEVEN_EIGHTHS, 39 three_quarters: THREE_QUARTERS, 40 five_eighths: FIVE_EIGHTHS, 41 half: HALF, 42 three_eighths: THREE_EIGHTHS, 43 one_quarter: ONE_QUARTER, 44 one_eighth: ONE_EIGHTH, 45 empty: " ", 46 }; 47 } 48 49 pub mod bar { 50 pub const FULL: &str = "█"; 51 pub const SEVEN_EIGHTHS: &str = "▇"; 52 pub const THREE_QUARTERS: &str = "▆"; 53 pub const FIVE_EIGHTHS: &str = "▅"; 54 pub const HALF: &str = "▄"; 55 pub const THREE_EIGHTHS: &str = "▃"; 56 pub const ONE_QUARTER: &str = "▂"; 57 pub const ONE_EIGHTH: &str = "▁"; 58 59 #[derive(Debug, Clone)] 60 pub struct Set { 61 pub full: &'static str, 62 pub seven_eighths: &'static str, 63 pub three_quarters: &'static str, 64 pub five_eighths: &'static str, 65 pub half: &'static str, 66 pub three_eighths: &'static str, 67 pub one_quarter: &'static str, 68 pub one_eighth: &'static str, 69 pub empty: &'static str, 70 } 71 72 pub const THREE_LEVELS: Set = Set { 73 full: FULL, 74 seven_eighths: FULL, 75 three_quarters: HALF, 76 five_eighths: HALF, 77 half: HALF, 78 three_eighths: HALF, 79 one_quarter: HALF, 80 one_eighth: " ", 81 empty: " ", 82 }; 83 84 pub const NINE_LEVELS: Set = Set { 85 full: FULL, 86 seven_eighths: SEVEN_EIGHTHS, 87 three_quarters: THREE_QUARTERS, 88 five_eighths: FIVE_EIGHTHS, 89 half: HALF, 90 three_eighths: THREE_EIGHTHS, 91 one_quarter: ONE_QUARTER, 92 one_eighth: ONE_EIGHTH, 93 empty: " ", 94 }; 95 } 96 97 pub mod line { 98 pub const VERTICAL: &str = "│"; 99 pub const DOUBLE_VERTICAL: &str = "║"; 100 pub const THICK_VERTICAL: &str = "┃"; 101 102 pub const HORIZONTAL: &str = "─"; 103 pub const DOUBLE_HORIZONTAL: &str = "═"; 104 pub const THICK_HORIZONTAL: &str = "━"; 105 106 pub const TOP_RIGHT: &str = "┐"; 107 pub const ROUNDED_TOP_RIGHT: &str = "╮"; 108 pub const DOUBLE_TOP_RIGHT: &str = "╗"; 109 pub const THICK_TOP_RIGHT: &str = "┓"; 110 111 pub const TOP_LEFT: &str = "┌"; 112 pub const ROUNDED_TOP_LEFT: &str = "╭"; 113 pub const DOUBLE_TOP_LEFT: &str = "╔"; 114 pub const THICK_TOP_LEFT: &str = "┏"; 115 116 pub const BOTTOM_RIGHT: &str = "┘"; 117 pub const ROUNDED_BOTTOM_RIGHT: &str = "╯"; 118 pub const DOUBLE_BOTTOM_RIGHT: &str = "╝"; 119 pub const THICK_BOTTOM_RIGHT: &str = "┛"; 120 121 pub const BOTTOM_LEFT: &str = "└"; 122 pub const ROUNDED_BOTTOM_LEFT: &str = "╰"; 123 pub const DOUBLE_BOTTOM_LEFT: &str = "╚"; 124 pub const THICK_BOTTOM_LEFT: &str = "┗"; 125 126 pub const VERTICAL_LEFT: &str = "┤"; 127 pub const DOUBLE_VERTICAL_LEFT: &str = "╣"; 128 pub const THICK_VERTICAL_LEFT: &str = "┫"; 129 130 pub const VERTICAL_RIGHT: &str = "├"; 131 pub const DOUBLE_VERTICAL_RIGHT: &str = "╠"; 132 pub const THICK_VERTICAL_RIGHT: &str = "┣"; 133 134 pub const HORIZONTAL_DOWN: &str = "┬"; 135 pub const DOUBLE_HORIZONTAL_DOWN: &str = "╦"; 136 pub const THICK_HORIZONTAL_DOWN: &str = "┳"; 137 138 pub const HORIZONTAL_UP: &str = "┴"; 139 pub const DOUBLE_HORIZONTAL_UP: &str = "╩"; 140 pub const THICK_HORIZONTAL_UP: &str = "┻"; 141 142 pub const CROSS: &str = "┼"; 143 pub const DOUBLE_CROSS: &str = "╬"; 144 pub const THICK_CROSS: &str = "╋"; 145 146 #[derive(Debug, Clone)] 147 pub struct Set { 148 pub vertical: &'static str, 149 pub horizontal: &'static str, 150 pub top_right: &'static str, 151 pub top_left: &'static str, 152 pub bottom_right: &'static str, 153 pub bottom_left: &'static str, 154 pub vertical_left: &'static str, 155 pub vertical_right: &'static str, 156 pub horizontal_down: &'static str, 157 pub horizontal_up: &'static str, 158 pub cross: &'static str, 159 } 160 161 pub const NORMAL: Set = Set { 162 vertical: VERTICAL, 163 horizontal: HORIZONTAL, 164 top_right: TOP_RIGHT, 165 top_left: TOP_LEFT, 166 bottom_right: BOTTOM_RIGHT, 167 bottom_left: BOTTOM_LEFT, 168 vertical_left: VERTICAL_LEFT, 169 vertical_right: VERTICAL_RIGHT, 170 horizontal_down: HORIZONTAL_DOWN, 171 horizontal_up: HORIZONTAL_UP, 172 cross: CROSS, 173 }; 174 175 pub const ROUNDED: Set = Set { 176 top_right: ROUNDED_TOP_RIGHT, 177 top_left: ROUNDED_TOP_LEFT, 178 bottom_right: ROUNDED_BOTTOM_RIGHT, 179 bottom_left: ROUNDED_BOTTOM_LEFT, 180 ..NORMAL 181 }; 182 183 pub const DOUBLE: Set = Set { 184 vertical: DOUBLE_VERTICAL, 185 horizontal: DOUBLE_HORIZONTAL, 186 top_right: DOUBLE_TOP_RIGHT, 187 top_left: DOUBLE_TOP_LEFT, 188 bottom_right: DOUBLE_BOTTOM_RIGHT, 189 bottom_left: DOUBLE_BOTTOM_LEFT, 190 vertical_left: DOUBLE_VERTICAL_LEFT, 191 vertical_right: DOUBLE_VERTICAL_RIGHT, 192 horizontal_down: DOUBLE_HORIZONTAL_DOWN, 193 horizontal_up: DOUBLE_HORIZONTAL_UP, 194 cross: DOUBLE_CROSS, 195 }; 196 197 pub const THICK: Set = Set { 198 vertical: THICK_VERTICAL, 199 horizontal: THICK_HORIZONTAL, 200 top_right: THICK_TOP_RIGHT, 201 top_left: THICK_TOP_LEFT, 202 bottom_right: THICK_BOTTOM_RIGHT, 203 bottom_left: THICK_BOTTOM_LEFT, 204 vertical_left: THICK_VERTICAL_LEFT, 205 vertical_right: THICK_VERTICAL_RIGHT, 206 horizontal_down: THICK_HORIZONTAL_DOWN, 207 horizontal_up: THICK_HORIZONTAL_UP, 208 cross: THICK_CROSS, 209 }; 210 } 211 212 pub const DOT: &str = "•"; 213 214 pub mod braille { 215 pub const BLANK: u16 = 0x2800; 216 pub const DOTS: [[u16; 2]; 4] = [ 217 [0x0001, 0x0008], 218 [0x0002, 0x0010], 219 [0x0004, 0x0020], 220 [0x0040, 0x0080], 221 ]; 222 } 223 224 /// Marker to use when plotting data points 225 #[derive(Debug, Clone, Copy)] 226 pub enum Marker { 227 /// One point per cell in shape of dot 228 Dot, 229 /// One point per cell in shape of a block 230 Block, 231 /// Up to 8 points per cell 232 Braille, 233 } 234