this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(job): collect compressors directly instead of round-tripping names

+8 -19
-9
src/backends/pipeline.rs
··· 17 17 Pipeline { compressors } 18 18 } 19 19 20 - /// Create a new Pipeline from compressor type names 21 - pub fn from_names(compressor_names: &[String]) -> Result<Self> { 22 - let compressors = compressor_names 23 - .iter() 24 - .map(|name| Self::create_compressor(name)) 25 - .collect::<Result<Vec<_>>>()?; 26 - Ok(Self { compressors }) 27 - } 28 - 29 20 /// Get a string representation of the chained format (e.g., "tar.gz") 30 21 fn format_chain(&self) -> String { 31 22 self.compressors
+8 -10
src/job.rs
··· 375 375 // e.g., "a.b.tar.gz" → gz ✓, tar ✓, b ✗ stop → [gz, tar] 376 376 // `chain_from_ext` handles both single-codec extensions and compound 377 377 // shortcuts like `tgz` (which expand to `[tar, gz]`). 378 - let mut compressor_names: Vec<String> = Vec::new(); 378 + let mut chain: Vec<Box<dyn Compressor>> = Vec::new(); 379 379 for ext in parts[1..].iter().rev() { 380 380 match backends::chain_from_ext(ext) { 381 - Some(chain) => { 382 - // chain is innermost→outermost; we walk the filename 381 + Some(stage) => { 382 + // stage is innermost→outermost; we walk the filename 383 383 // right-to-left so we push outermost first. 384 - for c in chain.iter().rev() { 385 - compressor_names.push(c.name().to_string()); 384 + for c in stage.into_iter().rev() { 385 + chain.push(c); 386 386 } 387 387 } 388 388 None => break, 389 389 } 390 390 } 391 391 392 - if compressor_names.is_empty() { 392 + if chain.is_empty() { 393 393 return None; 394 394 } 395 395 396 396 // Reverse to innermost-to-outermost order 397 - compressor_names.reverse(); 398 - Pipeline::from_names(&compressor_names) 399 - .ok() 400 - .map(|m| Box::new(m) as Box<dyn Compressor>) 397 + chain.reverse(); 398 + Some(Box::new(Pipeline::new(chain))) 401 399 } 402 400 403 401 /// Convert an input path into a Path