Skip to main content

ProcessLimits

Struct ProcessLimits 

Source
pub struct ProcessLimits {
    pub timeout: Duration,
    pub max_input_bytes: usize,
    pub max_output_bytes: usize,
    pub inherit_env: bool,
}
Expand description

Limits for one isolated process call. 单次隔离进程调用的限制。

Fields§

§timeout: Duration

Wall-clock deadline for one call; on expiry the host kills the child. 单次调用的挂钟超时;到期即由宿主终止子进程。

§max_input_bytes: usize

Largest request payload accepted, in bytes. 接受的最大请求负载字节数。

§max_output_bytes: usize

Largest response payload accepted, in bytes. Checked against the length the child declares, before the host allocates the buffer. 接受的最大响应负载字节数。以子进程声明的长度为准,在宿主分配缓冲区之前检查。

§inherit_env: bool

Whether the child inherits this host’s environment. 子进程是否继承本宿主的环境。

The default is true, which is what a host that has always run its plugin this way expects. Setting it to false clears the environment instead, so an untrusted plugin cannot read the host’s tokens, credentials, or configuration out of it; a host that needs to pass something specific adds it with ProcessProgram::environment, and the plugin executable itself still starts because it is run by absolute path. 默认是 true,也就是一直这样运行插件的宿主所期望的行为。设为 false 时会清空环境, 使不受信任的插件无法从中读到宿主的令牌、凭据或配置;需要传特定变量的宿主用 ProcessProgram::environment 显式添加,而插件可执行文件本身仍能启动,因为它以绝对 路径执行。

Trait Implementations§

Source§

impl Clone for ProcessLimits

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 Copy for ProcessLimits

Source§

impl Debug for ProcessLimits

Source§

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

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

impl Default for ProcessLimits

Source§

fn default() -> Self

Returns the “default value” for a type. 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.