Skip to main content

ExecRequest

Struct ExecRequest 

Source
pub struct ExecRequest { /* private fields */ }
Expand description

Structured child execution request independent from CLI parsing.

Built via new followed by builder methods. Validates that the working directory exists and that a command is provided.

Implementations§

Source§

impl ExecRequest

Source

pub fn new( cwd: impl Into<PathBuf>, argv: Vec<String>, allowed_env: Vec<String>, ) -> Result<Self>

Create a validated execution request.

Returns Error::MissingCommand when argv is empty and Error::InvalidCwd when cwd is not an existing directory.

Source

pub const fn with_stdio_policy(self, stdio_policy: StdioPolicy) -> Self

Set the child stdio handling policy.

Source

pub fn with_env_policy( self, env_policy: EnvPolicy, denied_env: Vec<String>, ) -> Self

Set the environment policy and denied keys.

Source

pub fn with_env(self, allowed_env: Vec<String>, denied_env: Vec<String>) -> Self

Set both allowed and denied environment keys.

Sets the policy to EnvPolicy::Allowlist.

Source

pub const fn with_network_mode(self, network_mode: NetworkMode) -> Self

Set the child network isolation mode.

Source

pub fn with_filesystem_policy( self, filesystem_policy: Option<FilesystemPolicy>, ) -> Result<Self>

Set the filesystem sandbox policy.

Some declares confinement, where an empty value confines read-only. None leaves the child unconfined by filesystem rules unless another isolation request applies. Returns an error when filesystem policy validation fails.

Source

pub const fn with_proc_mode(self, proc_mode: ProcMode) -> Self

Set the /proc mount policy.

Source

pub const fn with_agent_policy(self, agent_policy: AgentPolicy) -> Self

Set the host agent socket mount policy.

Source

pub fn needs_isolation(&self) -> bool

Whether this request needs OS-level isolation.

Returns true when network isolation, a declared filesystem stance (an empty block confines read-only), or host agent socket access is requested.

Source

pub fn cwd(&self) -> &Path

Child working directory.

Source

pub fn argv(&self) -> &[String]

Child command argv, including program name at index zero.

Source

pub fn allowed_env(&self) -> &[String]

Parent environment keys allowed in the child environment.

Source

pub fn denied_env(&self) -> &[String]

Parent environment keys denied in blocklist mode.

Source

pub const fn env_policy(&self) -> EnvPolicy

Child environment filtering policy.

Source

pub const fn stdio_policy(&self) -> StdioPolicy

Child stdio handling policy.

Source

pub const fn network_mode(&self) -> NetworkMode

Child network isolation policy.

Source

pub fn filesystem_policy(&self) -> Option<&FilesystemPolicy>

Filesystem stance declared by the caller.

None means no filesystem confinement was declared; Some carries the controls, where an empty value confines read-only.

Source

pub fn effective_filesystem_policy(&self) -> Cow<'_, FilesystemPolicy>

Filesystem controls in force under isolation.

Isolation paths call this after needs_isolation() returns true; a request that declared no filesystem block confines read-only through the empty policy, which both renderers treat as their closed-by-default base profile.

Source

pub const fn proc_mode(&self) -> ProcMode

Proc filesystem mount policy.

Source

pub const fn agent_policy(&self) -> AgentPolicy

Host agent socket mount policy.

Trait Implementations§

Source§

impl Clone for ExecRequest

Source§

fn clone(&self) -> ExecRequest

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 ExecRequest

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for ExecRequest

Source§

impl PartialEq for ExecRequest

Source§

fn eq(&self, other: &ExecRequest) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ExecRequest

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, <T as TryFrom<U>>::Error>

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.