Trait Interface

Source
pub trait Interface {
    type ErrorType;

    // Required methods
    fn welcome(
        &mut self,
        installer_name: &'static str,
        installer_version: &'static str,
        installer_author: &'static str,
    ) -> Result<(), Self::ErrorType>;
    fn get_install_method(&mut self) -> Result<InstallMethod, Self::ErrorType>;
    fn should_uninstall(&self) -> Result<bool, Self::ErrorType>;
    fn run_install(
        &mut self,
        install: &mut dyn Installer,
        install_dir: &Path,
        method: InstallMethod,
        resources: &HashMap<&'static str, &'static [u8]>,
    ) -> Result<(), Self::ErrorType>;
    fn run_post_install(
        &mut self,
        post_install: &mut dyn PostInstall,
        install_dir: &Path,
    ) -> Result<(), Self::ErrorType>;
    fn run_uninstall(
        &mut self,
        install: &mut dyn Installer,
        install_dir: &Path,
        method: InstallMethod,
        resources: &HashMap<&'static str, &'static [u8]>,
    ) -> Result<(), Self::ErrorType>;
    fn run_post_uninstall(
        &mut self,
        post_uninstall: &mut dyn PostUninstall,
        install_dir: &Path,
    ) -> Result<(), Self::ErrorType>;
    fn error(&mut self, err: Self::ErrorType) -> i32;
    fn finish(&mut self) -> i32;
}
Expand description

Represents an interface

Required Associated Types§

Required Methods§

Source

fn welcome( &mut self, installer_name: &'static str, installer_version: &'static str, installer_author: &'static str, ) -> Result<(), Self::ErrorType>

Opens the welcome page for this interface

§Arguments
  • installer_name - the name of this installer
  • installer_version - the version of this installer
  • installer_author - the author or company name of this installer
Source

fn get_install_method(&mut self) -> Result<InstallMethod, Self::ErrorType>

Returns the install method the user chose (only called if the installer supports both modes to decide which mode should be used to continue)

§Returns

an InstallMethod

Source

fn should_uninstall(&self) -> Result<bool, Self::ErrorType>

Returns wether the user chose the uninstall option or the install option

Source

fn run_install( &mut self, install: &mut dyn Installer, install_dir: &Path, method: InstallMethod, resources: &HashMap<&'static str, &'static [u8]>, ) -> Result<(), Self::ErrorType>

Runs the install procedure for this interface

§Arguments
  • install - the installer trait
  • install_dir - the computed installation directory
  • method - the installation method
  • resources - the resources map built by InstallerBuilder
Source

fn run_post_install( &mut self, post_install: &mut dyn PostInstall, install_dir: &Path, ) -> Result<(), Self::ErrorType>

Runs the post-install procedure for this interface

§Arguments
  • post_install - the custom PostInstall step
  • install_dir - the computed installation directory
Source

fn run_uninstall( &mut self, install: &mut dyn Installer, install_dir: &Path, method: InstallMethod, resources: &HashMap<&'static str, &'static [u8]>, ) -> Result<(), Self::ErrorType>

Runs the uninstall procedure for this interface

§Arguments
  • install - the installer trait
  • install_dir - the computed installation directory
  • method - the installation method
  • resources - the resources map built by InstallerBuilder
Source

fn run_post_uninstall( &mut self, post_uninstall: &mut dyn PostUninstall, install_dir: &Path, ) -> Result<(), Self::ErrorType>

Runs the post-uninstall procedure for this interface

§Arguments
  • post_uninstall - the custom PostUninstall step
  • install_dir - the computed installation directory
Source

fn error(&mut self, err: Self::ErrorType) -> i32

Called when an error has occured

§Arguments
  • err - the error object
§Returns

expected program exit code for the given error object

Source

fn finish(&mut self) -> i32

Called when no error has occured and the installer is finished

§Returns

expected program exit code

Implementors§