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§
Sourcefn id(&self) -> &'static str
fn id(&self) -> &'static str
A unique, human-readable identifier for this loader (e.g. "BepInEx").
Sourcefn package_install_rules(&self) -> InstallRuleset<'_>
fn package_install_rules(&self) -> InstallRuleset<'_>
Returns the install rules for the loader’s own files (the “loader pack”).
Sourcefn loader_install_rules(&self) -> InstallRuleset<'_>
fn loader_install_rules(&self) -> InstallRuleset<'_>
Returns the install rules for end-user mod packages.
Sourcefn generate_launch_args(&self, ctx: &LaunchContext<'_>) -> Result<LaunchArgs>
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§
Sourcefn prepare_launch(&self, ctx: &LaunchContext<'_>) -> Result<()>
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.
Sourcefn package_dir(&self, package: &PackageRef) -> Option<PathBuf>
fn package_dir(&self, package: &PackageRef) -> Option<PathBuf>
Returns the directory where a package’s files are placed, if any.
Sourcefn package_config_dirs(&self) -> Vec<PathBuf>
fn package_config_dirs(&self) -> Vec<PathBuf>
Directories that contain mutable per-package configuration.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".