libobs_wrapper\bootstrap/
options.rs

1pub const GITHUB_REPO: &'static str = "sshcrack/libobs-builds";
2
3#[derive(Debug, Clone)]
4pub struct ObsBootstrapperOptions {
5    pub(crate) repository: String,
6    pub(crate) update: bool,
7    pub(crate) restart_after_update: bool
8}
9
10impl ObsBootstrapperOptions {
11    pub fn new() -> Self {
12        ObsBootstrapperOptions {
13            repository: GITHUB_REPO.to_string(),
14            update: true,
15            restart_after_update: true
16        }
17    }
18
19    pub fn set_repository(mut self, repository: &str) -> Self {
20        self.repository = repository.to_string();
21        self
22    }
23
24    pub fn get_repository(&self) -> &str {
25        &self.repository
26    }
27
28    /// `true` if the updater should check for updates and download them if available.
29    /// `false` if the updater should not check for updates and only install OBS if required.
30    pub fn set_update(mut self, update: bool) -> Self {
31        self.update = update;
32        self
33    }
34
35    /// Disables the automatic restart of the application after the update is applied.
36    pub fn set_no_restart(mut self) -> Self {
37        self.restart_after_update = false;
38        self
39    }
40}
41
42impl Default for ObsBootstrapperOptions {
43    fn default() -> Self {
44        ObsBootstrapperOptions::new()
45    }
46}