| 111 | } |
| 112 | |
| 113 | fn next_character(&mut self) -> Option<String> { |
| 114 | if !self.is_running { |
| 115 | return None; |
| 116 | } |
| 117 | |
| 118 | if self.current_index >= self.full_text.chars().count() { |
| 119 | self.is_running = false; |
| 120 | return None; |
| 121 | } |
| 122 | |
| 123 | let chars: Vec<char> = self.full_text.chars().collect(); |
| 124 | if self.current_index + 5 <= self.full_text.chars().count() |
| 125 | && chars[self.current_index..self.current_index + 5] == ['{', 'n', 'n', 's', '}'] |
| 126 | { |
| 127 | self.current_index += 5; |
| 128 | } |
| 129 | let displayed_text: String = chars[..=self.current_index].iter().collect(); |
| 130 | self.current_index += 1; |
| 131 | |
| 132 | Some(displayed_text) |
| 133 | } |
| 134 | } |