pub trait EmulatorContext: Sized {
    // Required methods
    fn cmd_name(&self) -> String;
    fn args(&self) -> Vec<String>;
    fn env(&self) -> Vec<(String, String)>;
    fn working_dir(&self) -> Utf8PathBuf;
    fn prepare(&mut self) -> Result<(), Error>;

    // Provided method
    fn run(self) -> Result<Output, Error> { ... }
}
Expand description

Behavior used to run an emulator.

Required Methods§

source

fn cmd_name(&self) -> String

Returns the name of the base command to be executed.

Typically this is the executable file of the emulator (e.g. BizHawk.exe or fceux.exe).

If the executable is a linux binary in the working-directory, be sure to use ./cmd_name rather than just cmd_name.

source

fn args(&self) -> Vec<String>

Returns a list of arguments to be passed to Command::args.

source

fn env(&self) -> Vec<(String, String)>

Returns a list of environment variables to be passed to Command::envs.

source

fn working_dir(&self) -> Utf8PathBuf

Returns the path to the working directory intended for the command’s child process.

Refer to Command::current_dir for more details.

source

fn prepare(&mut self) -> Result<(), Error>

Perform any file copying or final checks to ensure context is ready for running.

Returns an error if preparation failed.

Provided Methods§

source

fn run(self) -> Result<Output, Error>

Creates and executes a Command and returns the output result.

Default trait implementation simply calls run.

Implementors§