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