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§
Sourcefn welcome(
&mut self,
installer_name: &'static str,
installer_version: &'static str,
installer_author: &'static str,
) -> Result<(), Self::ErrorType>
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 installerinstaller_version
- the version of this installerinstaller_author
- the author or company name of this installer
Sourcefn get_install_method(&mut self) -> Result<InstallMethod, Self::ErrorType>
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
Sourcefn should_uninstall(&self) -> Result<bool, Self::ErrorType>
fn should_uninstall(&self) -> Result<bool, Self::ErrorType>
Returns wether the user chose the uninstall option or the install option
Sourcefn run_install(
&mut self,
install: &mut dyn Installer,
install_dir: &Path,
method: InstallMethod,
resources: &HashMap<&'static str, &'static [u8]>,
) -> Result<(), 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>
Runs the install procedure for this interface
§Arguments
install
- the installer traitinstall_dir
- the computed installation directorymethod
- the installation methodresources
- the resources map built by InstallerBuilder
Sourcefn run_post_install(
&mut self,
post_install: &mut dyn PostInstall,
install_dir: &Path,
) -> Result<(), Self::ErrorType>
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 stepinstall_dir
- the computed installation directory
Sourcefn run_uninstall(
&mut self,
install: &mut dyn Installer,
install_dir: &Path,
method: InstallMethod,
resources: &HashMap<&'static str, &'static [u8]>,
) -> 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>
Runs the uninstall procedure for this interface
§Arguments
install
- the installer traitinstall_dir
- the computed installation directorymethod
- the installation methodresources
- the resources map built by InstallerBuilder
Sourcefn run_post_uninstall(
&mut self,
post_uninstall: &mut dyn PostUninstall,
install_dir: &Path,
) -> Result<(), Self::ErrorType>
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 stepinstall_dir
- the computed installation directory