MCPcopy Create free account
hub / github.com/ddd/gpb / new

Method new

src/workers/progress.rs:16–47  ·  view source on GitHub ↗
(total_work: u64)

Source from the content-addressed store, hash-verified

14
15impl ProgressBars {
16 pub fn new(total_work: u64) -> Self {
17 let multi = MultiProgress::new();
18
19 // Main progress bar for overall progress with ETA
20 let total_pb = multi.add(ProgressBar::new(total_work));
21 total_pb.set_style(ProgressStyle::with_template(
22 "{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {pos}/{len} ({percent}%) - {msg} (ETA: {eta})")
23 .unwrap()
24 .with_key("eta", |state: &ProgressState, w: &mut dyn Write|
25 write!(w, "{:.1}s", state.eta().as_secs_f64()).unwrap())
26 .progress_chars("#>-"));
27 total_pb.set_message("Processing phone numbers...");
28
29 // Enhanced progress bar for hits with fancy emojis
30 let hits_pb = multi.add(ProgressBar::new_spinner());
31 hits_pb.set_style(ProgressStyle::with_template(
32 "{spinner:.green} [{elapsed_precise}] {prefix} 🎯 Hits: {pos} - {msg}")
33 .unwrap());
34 //hits_pb.set_prefix("[✅ HITS]");
35 hits_pb.enable_steady_tick(Duration::from_millis(100));
36
37 // Enhanced status bar for stats
38 let stats_pb = multi.add(ProgressBar::new_spinner());
39 stats_pb.set_style(ProgressStyle::with_template(
40 "{spinner:.blue} [{elapsed_precise}] {prefix} {msg}")
41 .unwrap());
42 //stats_pb.set_prefix("[ℹ️ STATUS]");
43 stats_pb.enable_steady_tick(Duration::from_millis(100));
44 stats_pb.set_message("Starting up...");
45
46 Self { total_pb, hits_pb, stats_pb }
47 }
48
49 pub fn update_progress(&self, completed: u64, total: Option<u64>) {
50 if let Some(total) = total {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected