parsli 0.0.1

Parallel status lines for Rust
Documentation
use std::collections::{VecDeque};
use std::sync::{Arc, RwLock};
use indicatif::{MultiProgress, ProgressDrawTarget};
use crate::graph::DependencyGraph;
use crate::task::Task;

// A wrapper for multiple concurrent progress bars
#[derive(Clone)]
pub struct TaskPool {
    /// Dependency graph
    graph: Arc<DependencyGraph>,
    /// Status bars and functions to pass them to
    queue: Arc<RwLock<VecDeque<Task>>>,
    /// Multi progress bar
    progress: Arc<MultiProgress>,
}


impl TaskPool {
    /// Creates a new status display
    pub fn new() -> Self {
        Self {
            queue: Arc::new(RwLock::new(VecDeque::new())),
            /// High refresh rate progress bar
            progress: Arc::new(MultiProgress::with_draw_target(
                ProgressDrawTarget::stderr_with_hz(60),
            )),
            /// Empty graph
            graph: Arc::new(DependencyGraph::new())
        }
    }
}