You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
841 B
49 lines
841 B
use super::*;
|
|
use std::{
|
|
iter::FromIterator as _,
|
|
};
|
|
use tokio::{
|
|
sync::{
|
|
oneshot,
|
|
watch,
|
|
},
|
|
task::{
|
|
self,
|
|
JoinHandle,
|
|
},
|
|
};
|
|
use termprogress::{
|
|
Display as _,
|
|
WithTitle,
|
|
ProgressBar,
|
|
};
|
|
|
|
#[derive(Debug)]
|
|
enum CommandKind
|
|
{
|
|
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct Command
|
|
{
|
|
comm: CommandKind,
|
|
comp: oneshot::Sender<()>,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct ProgressSender
|
|
{
|
|
shutdown: watch::Receiver<Result<(), ()>>,
|
|
}
|
|
|
|
/// Create the async progress counter and return a sender object and a handle to join the worker task.
|
|
pub async fn create_progress<P: ProgressBar + WithTitle,
|
|
I: IntoIterator<Item=String>>(high: usize, tasks: I) -> (ProgressSender, JoinHandle<()>)
|
|
{
|
|
let list = task_list::TaskList::from_iter(tasks);
|
|
let mut progress = P::with_title(50, &list);
|
|
|
|
todo!()
|
|
}
|