Skip to main content

LoaderInstaller

Trait LoaderInstaller 

Source
pub trait LoaderInstaller: Send + Sync {
    // Required methods
    fn loader_type(&self) -> LoaderType;
    fn available_versions<'life0, 'life1, 'async_trait>(
        &'life0 self,
        mc_version: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn install<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        mc_version: &'life1 str,
        instance_name: &'life2 str,
        base_dir: &'life3 Path,
        progress: ProgressFn,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Unified interface for all loaders (dependency-injection layer): callers only deal with &dyn LoaderInstaller and never need to know the concrete loader.

let loader: Box<dyn LoaderInstaller> = Box::new(FabricInstaller::latest());
loader.install("1.21.4", &base_dir, no_progress()).await?;

Required Methods§

Source

fn loader_type(&self) -> LoaderType

Source

fn available_versions<'life0, 'life1, 'async_trait>( &'life0 self, mc_version: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Versions of this loader available for the given MC version. Vanilla returns an empty vec (versions come from the MC manifest).

Source

fn install<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, mc_version: &'life1 str, instance_name: &'life2 str, base_dir: &'life3 Path, progress: ProgressFn, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Install this loader. Vanilla does the full install; others overlay on top of an installed vanilla. instance_name is caller-chosen to avoid same-version/different-loader collisions.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§