alpm_types/
file_type.rs

1//! File type handling.
2
3use serde::{Deserialize, Serialize};
4use strum::{AsRefStr, Display, EnumString, IntoStaticStr};
5
6/// The identifier of a file type used in ALPM.
7///
8/// These identifiers are used in the file names of file types such as binary packages (see
9/// [alpm-package]), source packages and repository sync databases (see alpm-repo-database).
10///
11/// [alpm-package]: https://alpm.archlinux.page/specifications/alpm-package.7.html
12#[derive(
13    AsRefStr,
14    Clone,
15    Copy,
16    Debug,
17    Deserialize,
18    Display,
19    EnumString,
20    Eq,
21    IntoStaticStr,
22    PartialEq,
23    Serialize,
24)]
25#[serde(untagged)]
26pub enum FileTypeIdentifier {
27    /// The identifier for [alpm-package] files.
28    ///
29    /// [alpm-package]: https://alpm.archlinux.page/specifications/alpm-package.7.html
30    #[serde(rename = "pkg")]
31    #[strum(to_string = "pkg")]
32    BinaryPackage,
33
34    /// The identifier for alpm-repo-database files.
35    #[serde(rename = "db")]
36    #[strum(to_string = "db")]
37    RepositorySyncDatabase,
38
39    /// The identifier for source package files.
40    #[serde(rename = "src")]
41    #[strum(to_string = "src")]
42    SourcePackage,
43}