alpm_types/compression.rs
1//! File compression related types.
2
3use serde::{Deserialize, Serialize};
4use strum::{AsRefStr, Display, EnumString, IntoStaticStr, VariantNames};
5
6/// The file extension of a compression algorithm.
7///
8/// Compression may be used for a set of different files in the ALPM context (e.g. [alpm-package],
9/// alpm-source-package, alpm-repo-database).
10/// Each algorithm uses a distinct file extension.
11///
12/// [alpm-package]: https://alpm.archlinux.page/specifications/alpm-package.7.html
13#[derive(
14 AsRefStr,
15 Clone,
16 Copy,
17 Debug,
18 Default,
19 Deserialize,
20 Display,
21 EnumString,
22 Eq,
23 IntoStaticStr,
24 PartialEq,
25 Serialize,
26 VariantNames,
27)]
28#[serde(untagged)]
29pub enum CompressionAlgorithmFileExtension {
30 /// The file extension for files compressed using the [compress] compression algorithm.
31 ///
32 /// [compress]: https://man.archlinux.org/man/compress.1
33 #[serde(rename = "Z")]
34 #[strum(to_string = "Z")]
35 Compress,
36
37 /// The file extension for files compressed using the [bzip2] compression algorithm.
38 ///
39 /// [bzip2]: https://man.archlinux.org/man/bzip2.1
40 #[serde(rename = "bz2")]
41 #[strum(to_string = "bz2")]
42 Bzip2,
43
44 /// The file extension for files compressed using the [gzip] compression algorithm.
45 ///
46 /// [gzip]: https://man.archlinux.org/man/gzip.1
47 #[serde(rename = "gz")]
48 #[strum(to_string = "gz")]
49 Gzip,
50
51 /// The file extension for files compressed using the [lrzip] compression algorithm.
52 ///
53 /// [lrzip]: https://man.archlinux.org/man/lrzip.1
54 #[serde(rename = "lrz")]
55 #[strum(to_string = "lrz")]
56 Lrzip,
57
58 /// The file extension for files compressed using the [lzip] compression algorithm.
59 ///
60 /// [lzip]: https://man.archlinux.org/man/lzip.1
61 #[serde(rename = "lz")]
62 #[strum(to_string = "lz")]
63 Lzip,
64
65 /// The file extension for files compressed using the [lz4] compression algorithm.
66 ///
67 /// [lz4]: https://man.archlinux.org/man/lz4.1
68 #[serde(rename = "lz4")]
69 #[strum(to_string = "lz4")]
70 Lz4,
71
72 /// The file extension for files compressed using the [lzop] compression algorithm.
73 ///
74 /// [lzop]: https://man.archlinux.org/man/lzop.1
75 #[serde(rename = "lzo")]
76 #[strum(to_string = "lzo")]
77 Lzop,
78
79 /// The file extension for files compressed using the [xz] compression algorithm.
80 ///
81 /// [xz]: https://man.archlinux.org/man/xz.1
82 #[serde(rename = "xz")]
83 #[strum(to_string = "xz")]
84 Xz,
85
86 /// The file extension for files compressed using the [zstd] compression algorithm.
87 ///
88 /// [zstd]: https://man.archlinux.org/man/zstd.1
89 #[default]
90 #[serde(rename = "zst")]
91 #[strum(to_string = "zst")]
92 Zstd,
93}