Skip to main content

EngineTarget

Struct EngineTarget 

Source
pub struct EngineTarget {
    pub binary: PathBuf,
    pub env: Vec<(String, String)>,
    pub data_dir_env: Option<String>,
    pub data_dir_arg: Option<String>,
    pub forbidden_args: Vec<String>,
    pub allow_no_data_dir_for_refusal_probe: bool,
}
Expand description

An engine binary and how to launch it without touching real user data.

Every launch (cli, run, start_sidecar) must name an isolated data directory, or it is refused before the process starts with a crate::userdata::UserDataViolation (rule no-isolated-data-dir). A directory is named when the caller’s CliOptions::data_dir reaches the engine through data_dir_env, or data_dir_env is set in the launch environment, or data_dir_arg appears in the arguments, and the directory passes crate::userdata::check_engine_dirs. A data_dir on a target that declares neither is not named: the engine would never see it.

Fields§

§binary: PathBuf§env: Vec<(String, String)>

Env applied to every engine process (e.g. GENRIGHT_NO_KEYCHAIN=1).

§data_dir_env: Option<String>

Env var that receives the per-scenario data dir (e.g. GENRIGHT_APP_DATA).

§data_dir_arg: Option<String>

Flag the engine takes its data dir under (e.g. --data-dir). Declaring it lets a caller name the isolated directory in the launch arguments; the harness only judges the value.

§forbidden_args: Vec<String>

Flags that select the real library (e.g. --use-user-library). A launch whose arguments contain one, as flag or flag=value, is refused. Empty by default; the product declares its own, this crate hard-codes none.

§allow_no_data_dir_for_refusal_probe: bool

Set by EngineTarget::allow_no_data_dir_for_refusal_probe; read it as a warning label.

Implementations§

Source§

impl EngineTarget

Source

pub fn new(binary: impl Into<PathBuf>) -> Self

A target with no environment, no data-dir variable or flag, and no deny list. Such a target cannot be launched until it declares data_dir_env or data_dir_arg (or the probe opt-out is used).

Source

pub fn with_data_dir_env(self, var: &str) -> Self

Env var that receives the data dir (e.g. GENRIGHT_APP_DATA).

Source

pub fn with_data_dir_arg(self, flag: &str) -> Self

Flag the engine takes its data dir under (e.g. --data-dir).

Source

pub fn forbid_args(self, flags: &[&str]) -> Self

Flags that select the real library; a launch carrying one is refused.

Source

pub fn allow_no_data_dir_for_refusal_probe(self) -> Self

Let launches of this target name no data directory, ONLY to assert the engine’s own refusal to run without one. Use it on a dedicated clone of the target, never on the target that runs real scenarios. A second barrier is still required: on Unix the launch environment (CliOptions::env or the target’s env) must redirect HOME into a QA directory, and XDG_DATA_HOME / XDG_CONFIG_HOME too wherever they are set or inherited; on Windows the Known Folder API ignores the environment, so the launch is refused whatever the caller passes. See crate::userdata::check_engine_launch.

Source

pub fn cli( &self, args: &[String], opts: &CliOptions, tracker: &Tracker, ) -> Result<CliResult>

Source

pub fn run( &self, words: &str, input: Value, opts: &CliOptions, tracker: &Tracker, ) -> Result<Value>

engine run('job status', input): words split, non-zero exit or json.error fails.

Source

pub fn start_sidecar( &self, opts: &CliOptions, tracker: &Tracker, ) -> Result<Sidecar>

Trait Implementations§

Source§

impl Clone for EngineTarget

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EngineTarget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.