pub struct LaunchArgs { /* private fields */ }Expand description
Arguments, environment variables, and an optional wrapper binary to use when launching a game with a mod loader.
Build one using the builder methods (arg,
env, wrapper), then call
apply to configure a
std::process::Command.
§Examples
use loadsmith_loader::LaunchArgs;
use std::process::Command;
let args = LaunchArgs::new()
.arg("--doorstop-enable")
.arg("true")
.env("DOORSTOP_ENABLE", "TRUE");
let mut cmd = Command::new("game.exe");
args.apply(&mut cmd);
assert_eq!(cmd.get_args().collect::<Vec<_>>(), ["--doorstop-enable", "true"]);Implementations§
Source§impl LaunchArgs
impl LaunchArgs
Sourcepub fn env(self, key: impl Into<OsString>, value: impl Into<OsString>) -> Self
pub fn env(self, key: impl Into<OsString>, value: impl Into<OsString>) -> Self
Sets an environment variable.
Sourcepub fn wrapper(self, wrapper: impl Into<PathBuf>) -> Self
pub fn wrapper(self, wrapper: impl Into<PathBuf>) -> Self
Sets a wrapper binary (e.g. wine or proton) that the command
should be launched through.
Sourcepub fn get_wrapper(&self) -> Option<&Path>
pub fn get_wrapper(&self) -> Option<&Path>
Returns the wrapper binary path, if set.
Sourcepub fn apply(self, command: &mut Command)
pub fn apply(self, command: &mut Command)
Applies these arguments, environment, and optional wrapper to a
std::process::Command.
When a wrapper is set the original command’s program and arguments become sub-arguments of the wrapper.
Trait Implementations§
Source§impl Clone for LaunchArgs
impl Clone for LaunchArgs
Source§fn clone(&self) -> LaunchArgs
fn clone(&self) -> LaunchArgs
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LaunchArgs
impl Debug for LaunchArgs
Source§impl Default for LaunchArgs
impl Default for LaunchArgs
Source§fn default() -> LaunchArgs
fn default() -> LaunchArgs
Returns the “default value” for a type. Read more
impl Eq for LaunchArgs
Source§impl PartialEq for LaunchArgs
impl PartialEq for LaunchArgs
impl StructuralPartialEq for LaunchArgs
Auto Trait Implementations§
impl Freeze for LaunchArgs
impl RefUnwindSafe for LaunchArgs
impl Send for LaunchArgs
impl Sync for LaunchArgs
impl Unpin for LaunchArgs
impl UnsafeUnpin for LaunchArgs
impl UnwindSafe for LaunchArgs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.