Files
Firelink/test_regex.rs
T
NimBold dc9289fece feat: refine sidebar UI and update download categories
- Restructured layout so the sidebar acts as an edge-to-edge curved layer with a shadow
- Replaced old download categories with Musics, Movies, Compressed, Documents, Pictures, Applications, and Other
- Updated Settings > Locations tab to handle the new categories
- Added extensive predefined file extensions for smart auto-categorization of downloads
2026-06-13 00:02:07 +03:30

14 lines
473 B
Rust

use regex::Regex;
fn main() {
let pct_re = Regex::new(r"\[download\]\s+(\d+(?:\.\d+)?)%").unwrap();
let line = "[download] 0.0% of 15.59MiB at 7.28KiB/s ETA 36:34";
if line.contains("[download]") && line.contains("%") {
let fraction = pct_re.captures(&line)
.and_then(|cap| cap.get(1))
.and_then(|m| m.as_str().parse::<f64>().ok())
.unwrap_or(0.0) / 100.0;
println!("Fraction: {}", fraction);
}
}