InstallObserver

Trait InstallObserver 

Source
pub trait InstallObserver {
    // Required method
    fn choose_package(
        &mut self,
        query: &str,
        matches: &[CatalogPackage],
    ) -> Result<usize>;

    // Provided methods
    fn on_start(&mut self, _total_bytes: Option<u64>) { ... }
    fn on_progress(&mut self, _downloaded_bytes: u64) { ... }
    fn on_install_start(&mut self, _message: &str) { ... }
    fn on_install_complete(&mut self) { ... }
    fn confirm_runtime_bootstrap(
        &mut self,
        runtime_name: &str,
        target_dir: &Path,
    ) -> Result<bool> { ... }
}
Expand description

Interactive hooks used by the installation pipeline.

The install flow uses this trait for the pieces of user interaction it needs to support. Package selection is required; the remaining hooks are optional and default to no-op behavior so callers only override the phases they care about.

Required Methods§

Source

fn choose_package( &mut self, query: &str, matches: &[CatalogPackage], ) -> Result<usize>

Choose one package from the catalog matches returned for a reference.

The callback receives the original query string and the resolved match set. Return the index of the package to install from the provided slice.

Provided Methods§

Source

fn on_start(&mut self, _total_bytes: Option<u64>)

Signal that installer download is about to start.

total_bytes is Some when the server provided a content length and None when the size is unknown ahead of time.

Source

fn on_progress(&mut self, _downloaded_bytes: u64)

Report cumulative installer download progress in bytes.

Source

fn on_install_start(&mut self, _message: &str)

Signal that the post-download install phase is starting.

Source

fn on_install_complete(&mut self)

Signal that the post-download install phase has completed.

The engine work has finished, but the install flow may still continue with commit, journal, and shim publication before returning.

Source

fn confirm_runtime_bootstrap( &mut self, runtime_name: &str, target_dir: &Path, ) -> Result<bool>

Confirm whether WinBrew may bootstrap a local 7-Zip runtime.

Implementors§