|
|
|
@ -14,7 +14,10 @@ use std::{
|
|
|
|
|
Poll,
|
|
|
|
|
},
|
|
|
|
|
pin::Pin,
|
|
|
|
|
|
|
|
|
|
iter::{
|
|
|
|
|
self,
|
|
|
|
|
Once,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
use tokio::{
|
|
|
|
|
sync::{
|
|
|
|
@ -58,6 +61,8 @@ enum CommandKind
|
|
|
|
|
RemoveTask(usize),
|
|
|
|
|
|
|
|
|
|
Complete,
|
|
|
|
|
|
|
|
|
|
Many(Vec<CommandKind>),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
@ -268,7 +273,29 @@ pub fn create_progress<P: ProgressBar + WithTitle + Send + 'static,
|
|
|
|
|
(comm, d)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum MaybeSingle
|
|
|
|
|
{
|
|
|
|
|
Single(Once<CommandKind>),
|
|
|
|
|
Many(Vec<CommandKind>),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl From<CommandKind> for MaybeSingle
|
|
|
|
|
{
|
|
|
|
|
fn from(from: CommandKind) -> Self
|
|
|
|
|
{
|
|
|
|
|
match from {
|
|
|
|
|
CommandKind::Many(many) => Self::Many(many),
|
|
|
|
|
x => Self::Single(iter::once(x)),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TODO: IntoIterator for Maybesingle??? We'll need our own type, I think. Maybe generalise it, and put in ext or util?
|
|
|
|
|
|
|
|
|
|
let command = MaybeSingle::from(command);
|
|
|
|
|
|
|
|
|
|
// Match the command
|
|
|
|
|
for command in command.into_iter() {
|
|
|
|
|
match command {
|
|
|
|
|
CommandKind::BumpHigh(high) => {
|
|
|
|
|
let stat = stat.to_mut();
|
|
|
|
@ -303,6 +330,7 @@ pub fn create_progress<P: ProgressBar + WithTitle + Send + 'static,
|
|
|
|
|
break;
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if let Cow::Owned(stat) = std::mem::replace(&mut stat, Cow::Borrowed(&last_stat /* wtf? how is this legal? idk*/)) {
|
|
|
|
|
//It's been written to
|
|
|
|
|