SandboxConfig

Struct SandboxConfig 

Source
pub struct SandboxConfig {
    pub io_permissions: IOPermissions,
    pub filesystem_policy: SandboxPolicy,
    pub filesystem_restriction: Option<PathRestriction>,
    pub module_policy: SandboxPolicy,
    pub module_restriction: Option<PathRestriction>,
    pub enable_metrics: bool,
    pub max_module_cache_size: usize,
    pub module_cache_ttl_secs: u64,
    pub execution_limits: ExecutionLimits,
}
Expand description

统一的沙箱配置

Fields§

§io_permissions: IOPermissions

IO 权限(保留向后兼容)

§filesystem_policy: SandboxPolicy

文件系统沙箱策略

§filesystem_restriction: Option<PathRestriction>

文件系统路径限制

§module_policy: SandboxPolicy

模块系统沙箱策略

§module_restriction: Option<PathRestriction>

模块路径限制

§enable_metrics: bool

是否启用可观测性指标收集

§max_module_cache_size: usize

最大模块缓存数量(0 = 不限制)

§module_cache_ttl_secs: u64

模块缓存 TTL(秒,0 = 永不过期)

§execution_limits: ExecutionLimits

执行限制配置

Implementations§

Source§

impl SandboxConfig

Source

pub fn dsl_safe() -> Self

创建 DSL 安全默认配置(禁用所有 IO,严格执行限制)

Source

pub fn cli_full_access() -> Self

创建 CLI 完全访问配置

Source

pub fn sandboxed(root_dir: PathBuf) -> Self

创建受限沙箱配置(仅允许 root_dir 内访问)

Trait Implementations§

Source§

impl Clone for SandboxConfig

Source§

fn clone(&self) -> SandboxConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SandboxConfig

Source§

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

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

impl Default for SandboxConfig

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> 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 = Infallible

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.