Skip to main content

Loader

Trait Loader 

Source
pub trait Loader:
    Debug
    + Send
    + Sync {
    // Required methods
    fn id(&self) -> &'static str;
    fn package_install_rules(&self) -> InstallRuleset<'_>;
    fn loader_install_rules(&self) -> InstallRuleset<'_>;
    fn generate_launch_args(
        &self,
        ctx: &LaunchContext<'_>,
    ) -> Result<LaunchArgs>;

    // Provided methods
    fn prepare_launch(&self, ctx: &LaunchContext<'_>) -> Result<()> { ... }
    fn package_dir(&self, package: &PackageRef) -> Option<PathBuf> { ... }
    fn package_config_dirs(&self) -> Vec<PathBuf> { ... }
    fn log_file(&self) -> Option<PathBuf> { ... }
    fn proxy_dll(&self) -> Option<PathBuf> { ... }
}
Expand description

A mod loader definition that knows how to install packages and generate launch arguments for a target game.

Each loader implementation describes:

  • How its own loader-pack files are placed (loader_install_rules).
  • How mod packages are placed (package_install_rules).
  • What CLI arguments / environment variables are needed at launch (generate_launch_args).

By default prepare_launch copies all top-level *.dll files from the profile into the game directory.

§Examples

use loadsmith_loader::{BepInEx, Loader};

let loader = BepInEx::with_default_rules();
assert_eq!(loader.id(), "BepInEx");

Required Methods§

Source

fn id(&self) -> &'static str

A unique, human-readable identifier for this loader (e.g. "BepInEx").

Source

fn package_install_rules(&self) -> InstallRuleset<'_>

Returns the install rules for the loader’s own files (the “loader pack”).

Source

fn loader_install_rules(&self) -> InstallRuleset<'_>

Returns the install rules for end-user mod packages.

Source

fn generate_launch_args(&self, ctx: &LaunchContext<'_>) -> Result<LaunchArgs>

Builds the command-line arguments and environment variables needed to launch the game with this loader.

Provided Methods§

Source

fn prepare_launch(&self, ctx: &LaunchContext<'_>) -> Result<()>

Prepares the game directory by copying files from the profile.

The default implementation copies every top-level *.dll file.

Source

fn package_dir(&self, package: &PackageRef) -> Option<PathBuf>

Returns the directory where a package’s files are placed, if any.

Source

fn package_config_dirs(&self) -> Vec<PathBuf>

Directories that contain mutable per-package configuration.

Source

fn log_file(&self) -> Option<PathBuf>

Path to the loader’s log file, relative to the game directory.

Source

fn proxy_dll(&self) -> Option<PathBuf>

Filename of the proxy DLL used by this loader, if any.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§