Write a byte to the console. # Arguments `byte` - Byte to be writen
(&mut self, byte: u8)
| 77 | /// |
| 78 | /// * `byte` - Byte to be writen |
| 79 | pub fn write_byte(&mut self, byte: u8) { |
| 80 | match byte { |
| 81 | b'\n' => self.new_line(), |
| 82 | b'\t' => for i in 0..2 { self.write_byte(b' ') }, |
| 83 | byte => { |
| 84 | if self.column_position >= BUFFER_WIDTH { |
| 85 | self.new_line(); |
| 86 | } |
| 87 | let row = self.row_positon; |
| 88 | let col = self.column_position; |
| 89 | |
| 90 | let color_code = self.color_code; |
| 91 | |
| 92 | self.buffer().chars[row][col].write(ScreenChar { |
| 93 | ascii_character: byte, |
| 94 | color_code: color_code, |
| 95 | }); |
| 96 | self.column_position += 1; |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | /// Gets a mutable reference to the console Buffer. |
| 102 | fn buffer(&mut self) -> &mut Buffer { |