| 244 | } |
| 245 | |
| 246 | pub(crate) fn push_command(&mut self, command: Commands) { |
| 247 | self.commands.push(command); |
| 248 | } |
| 249 | |
| 250 | pub(crate) fn backlog(&self) -> Vec<BackLogItem> { |
| 251 | let total = self.backlog.len(); |
| 252 | if total == 0 { |
| 253 | return vec![]; |
| 254 | } |
| 255 | |
| 256 | let end = total.saturating_sub(self.backlog_offset); |
| 257 | let start = end.saturating_sub(WINDOW_SIZE); |
| 258 | self.backlog[start..end].to_vec() |
| 259 | } |
| 260 | |
| 261 | pub(crate) fn last_voice(&self) -> Option<(String, String)> { |
| 262 | let backlog = self.backlog.last().unwrap(); |