1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//! A place for types related to alpm, rather than e.g. a package

use alpm_sys::*;

/// This version of libalpm's capabilities
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Caps {
    pub nls: bool,
    pub downloader: bool,
    pub signatures: bool,
}

impl From<u32> for Caps {
    fn from(f: u32) -> Caps {
        Caps {
            nls: f & ALPM_CAPABILITY_NLS != 0,
            downloader: f & ALPM_CAPABILITY_DOWNLOADER != 0,
            signatures: f & ALPM_CAPABILITY_SIGNATURES != 0,
        }
    }
}

/// The result of a download
pub enum DownloadResult {
    /// The download succeeded
    Ok,
    /// The download was not needed
    NotNeeded,
    /// The download failed
    Err,
}