|
|
@ -14,7 +14,10 @@ use std::{
|
|
|
|
Poll,
|
|
|
|
Poll,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
pin::Pin,
|
|
|
|
pin::Pin,
|
|
|
|
|
|
|
|
iter::{
|
|
|
|
|
|
|
|
self,
|
|
|
|
|
|
|
|
Once,
|
|
|
|
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use tokio::{
|
|
|
|
use tokio::{
|
|
|
|
sync::{
|
|
|
|
sync::{
|
|
|
@ -58,6 +61,8 @@ enum CommandKind
|
|
|
|
RemoveTask(usize),
|
|
|
|
RemoveTask(usize),
|
|
|
|
|
|
|
|
|
|
|
|
Complete,
|
|
|
|
Complete,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Many(Vec<CommandKind>),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
#[derive(Debug)]
|
|
|
@ -268,7 +273,29 @@ pub fn create_progress<P: ProgressBar + WithTitle + Send + 'static,
|
|
|
|
(comm, d)
|
|
|
|
(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
|
|
|
|
// Match the command
|
|
|
|
|
|
|
|
for command in command.into_iter() {
|
|
|
|
match command {
|
|
|
|
match command {
|
|
|
|
CommandKind::BumpHigh(high) => {
|
|
|
|
CommandKind::BumpHigh(high) => {
|
|
|
|
let stat = stat.to_mut();
|
|
|
|
let stat = stat.to_mut();
|
|
|
@ -303,6 +330,7 @@ pub fn create_progress<P: ProgressBar + WithTitle + Send + 'static,
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if let Cow::Owned(stat) = std::mem::replace(&mut stat, Cow::Borrowed(&last_stat /* wtf? how is this legal? idk*/)) {
|
|
|
|
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
|
|
|
|
//It's been written to
|
|
|
|