sword_layers/compression/
config.rs1use console::style;
2use serde::{Deserialize, Serialize};
3
4use crate::DisplayConfig;
5
6#[derive(Debug, Clone, Deserialize, Serialize, Default)]
18pub struct CompressionConfig {
19 #[serde(default)]
20 pub enabled: bool,
21
22 #[serde(default)]
23 pub algorithms: Vec<String>,
24
25 #[serde(default)]
26 pub display: bool,
27}
28
29impl DisplayConfig for CompressionConfig {
30 fn display(&self) {
31 if !self.display {
32 return;
33 }
34
35 println!("\n{}", style("Compression Configuration:").bold());
36
37 if self.enabled {
38 if self.algorithms.is_empty() {
39 println!(" ↳ {}", style("No algorithms enabled").yellow());
40 } else {
41 println!(" ↳ Algorithms: {}", self.algorithms.join(", "));
42 }
43 } else {
44 println!(" ↳ {}", style("Compression: disabled").red());
45 }
46 }
47}