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
33
34
#[derive(Default, Debug)]
pub struct App {
    pub bin_src: String,
    pub current_version: String,
    pub version_src: String,
}

impl App {
    pub fn new() -> Self {
        App {
            ..Default::default()
        }
    }

    /// Sets the remote source from which to download the updated package.
    pub fn bin_src(mut self, src: String) -> Self {
        // TODO: validate web address
        self.bin_src = src;
        self
    }

    /// Sets the current binary version.
    pub fn current_version(mut self, version: String) -> Self {
        // TODO: validate semver
        self.current_version = version;
        self
    }

    /// Sets the location from which to parse the latest binary version.
    pub fn version_src(mut self, src: String) -> Self {
        self.version_src = src;
        self
    }
}