pub struct ResourceConfig {
pub cpu: Option<CpuConfig>,
pub memory: Option<MemoryConfig>,
pub network: NetworkConfig,
pub filesystem: FilesystemConfig,
pub execution: ExecutionLimits,
}Expand description
Resource limits and capabilities configuration.
Fields§
§cpu: Option<CpuConfig>CPU limits.
memory: Option<MemoryConfig>Memory limits.
network: NetworkConfigNetwork configuration.
filesystem: FilesystemConfigFilesystem capabilities.
execution: ExecutionLimitsExecution limits.
Implementations§
Source§impl ResourceConfig
impl ResourceConfig
Sourcepub fn with_memory(self, memory: MemoryConfig) -> Self
pub fn with_memory(self, memory: MemoryConfig) -> Self
Set memory limits.
Sourcepub fn with_network(self, network: NetworkConfig) -> Self
pub fn with_network(self, network: NetworkConfig) -> Self
Set network configuration.
Sourcepub fn with_filesystem(self, filesystem: FilesystemConfig) -> Self
pub fn with_filesystem(self, filesystem: FilesystemConfig) -> Self
Set filesystem configuration.
Sourcepub fn with_execution(self, execution: ExecutionLimits) -> Self
pub fn with_execution(self, execution: ExecutionLimits) -> Self
Set execution limits.
Sourcepub fn with_network_enabled(self) -> Self
pub fn with_network_enabled(self) -> Self
Enable network access with default settings.
Sourcepub fn with_network_disabled(self) -> Self
pub fn with_network_disabled(self) -> Self
Disable network access.
Sourcepub fn with_timeout(self, seconds: u64) -> Self
pub fn with_timeout(self, seconds: u64) -> Self
Set execution timeout.
Sourcepub fn with_memory_limit(self, limit: impl Into<String>) -> Self
pub fn with_memory_limit(self, limit: impl Into<String>) -> Self
Set memory limit using a size string (e.g., “512m”, “2g”).
Sourcepub fn with_cpu_limit(self, limit: impl Into<String>) -> Self
pub fn with_cpu_limit(self, limit: impl Into<String>) -> Self
Set CPU limit.
Trait Implementations§
Source§impl Clone for ResourceConfig
impl Clone for ResourceConfig
Source§fn clone(&self) -> ResourceConfig
fn clone(&self) -> ResourceConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResourceConfig
impl Debug for ResourceConfig
Source§impl Default for ResourceConfig
impl Default for ResourceConfig
Source§fn default() -> ResourceConfig
fn default() -> ResourceConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ResourceConfig
impl<'de> Deserialize<'de> for ResourceConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ResourceConfig
impl RefUnwindSafe for ResourceConfig
impl Send for ResourceConfig
impl Sync for ResourceConfig
impl Unpin for ResourceConfig
impl UnwindSafe for ResourceConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more