pub struct SandboxResourcesPatch {
pub cpus: Option<u8>,
pub memory_mib: Option<u32>,
pub max_cpus: Option<u8>,
pub max_memory_mib: Option<u32>,
pub cpu_placement: Option<CpuPlacement>,
pub placement_profile: Option<Option<String>>,
pub thp: Option<TransparentHugePagePolicy>,
}Expand description
A sparse, presence-aware patch for SandboxResources.
Fields§
§cpus: Option<u8>Pending update for cpus. Omitted values leave the target unchanged.
memory_mib: Option<u32>Pending update for memory_mib. Omitted values leave the target unchanged.
max_cpus: Option<u8>Pending update for max_cpus. Omitted values leave the target unchanged.
max_memory_mib: Option<u32>Pending update for max_memory_mib. Omitted values leave the target unchanged.
cpu_placement: Option<CpuPlacement>Pending update for cpu_placement. Omitted values leave the target unchanged.
placement_profile: Option<Option<String>>Pending update for placement_profile. Omitted values leave the target unchanged.
thp: Option<TransparentHugePagePolicy>Pending update for thp. Omitted values leave the target unchanged.
Implementations§
Source§impl SandboxResourcesPatch
impl SandboxResourcesPatch
Sourcepub fn cpus_mut(&mut self, value: u8) -> &mut Self
pub fn cpus_mut(&mut self, value: u8) -> &mut Self
Set the cpus field in this patch.
Mutates this patch in place and returns it for chaining.
Sourcepub fn memory_mib(self, value: u32) -> Self
pub fn memory_mib(self, value: u32) -> Self
Set the memory_mib field in this patch.
Sourcepub fn memory_mib_mut(&mut self, value: u32) -> &mut Self
pub fn memory_mib_mut(&mut self, value: u32) -> &mut Self
Set the memory_mib field in this patch.
Mutates this patch in place and returns it for chaining.
Sourcepub fn max_cpus_mut(&mut self, value: u8) -> &mut Self
pub fn max_cpus_mut(&mut self, value: u8) -> &mut Self
Set the max_cpus field in this patch.
Mutates this patch in place and returns it for chaining.
Sourcepub fn max_memory_mib(self, value: u32) -> Self
pub fn max_memory_mib(self, value: u32) -> Self
Set the max_memory_mib field in this patch.
Sourcepub fn max_memory_mib_mut(&mut self, value: u32) -> &mut Self
pub fn max_memory_mib_mut(&mut self, value: u32) -> &mut Self
Set the max_memory_mib field in this patch.
Mutates this patch in place and returns it for chaining.
Sourcepub fn cpu_placement(self, value: CpuPlacement) -> Self
pub fn cpu_placement(self, value: CpuPlacement) -> Self
Set the cpu_placement field in this patch.
Sourcepub fn cpu_placement_mut(&mut self, value: CpuPlacement) -> &mut Self
pub fn cpu_placement_mut(&mut self, value: CpuPlacement) -> &mut Self
Set the cpu_placement field in this patch.
Mutates this patch in place and returns it for chaining.
Sourcepub fn set_placement_profile(self, value: Option<String>) -> Self
pub fn set_placement_profile(self, value: Option<String>) -> Self
Set or explicitly clear placement_profile.
Sourcepub fn set_placement_profile_mut(&mut self, value: Option<String>) -> &mut Self
pub fn set_placement_profile_mut(&mut self, value: Option<String>) -> &mut Self
Set or explicitly clear placement_profile.
Mutates this patch in place and returns it for chaining.
Sourcepub fn placement_profile(self, value: String) -> Self
pub fn placement_profile(self, value: String) -> Self
Set the placement_profile field in this patch.
Sourcepub fn placement_profile_mut(&mut self, value: String) -> &mut Self
pub fn placement_profile_mut(&mut self, value: String) -> &mut Self
Set the placement_profile field in this patch.
Mutates this patch in place and returns it for chaining.
Sourcepub fn thp(self, value: TransparentHugePagePolicy) -> Self
pub fn thp(self, value: TransparentHugePagePolicy) -> Self
Set the thp field in this patch.
Sourcepub fn thp_mut(&mut self, value: TransparentHugePagePolicy) -> &mut Self
pub fn thp_mut(&mut self, value: TransparentHugePagePolicy) -> &mut Self
Set the thp field in this patch.
Mutates this patch in place and returns it for chaining.
Sourcepub fn clear_cpus(self) -> Self
pub fn clear_cpus(self) -> Self
Remove cpus from this patch so applying it leaves the target unchanged.
Sourcepub fn clear_cpus_mut(&mut self) -> &mut Self
pub fn clear_cpus_mut(&mut self) -> &mut Self
Remove cpus from this patch so applying it leaves the target unchanged.
Mutates this patch in place and returns it for chaining.
Sourcepub fn clear_memory_mib(self) -> Self
pub fn clear_memory_mib(self) -> Self
Remove memory_mib from this patch so applying it leaves the target unchanged.
Sourcepub fn clear_memory_mib_mut(&mut self) -> &mut Self
pub fn clear_memory_mib_mut(&mut self) -> &mut Self
Remove memory_mib from this patch so applying it leaves the target unchanged.
Mutates this patch in place and returns it for chaining.
Sourcepub fn clear_max_cpus(self) -> Self
pub fn clear_max_cpus(self) -> Self
Remove max_cpus from this patch so applying it leaves the target unchanged.
Sourcepub fn clear_max_cpus_mut(&mut self) -> &mut Self
pub fn clear_max_cpus_mut(&mut self) -> &mut Self
Remove max_cpus from this patch so applying it leaves the target unchanged.
Mutates this patch in place and returns it for chaining.
Sourcepub fn clear_max_memory_mib(self) -> Self
pub fn clear_max_memory_mib(self) -> Self
Remove max_memory_mib from this patch so applying it leaves the target unchanged.
Sourcepub fn clear_max_memory_mib_mut(&mut self) -> &mut Self
pub fn clear_max_memory_mib_mut(&mut self) -> &mut Self
Remove max_memory_mib from this patch so applying it leaves the target unchanged.
Mutates this patch in place and returns it for chaining.
Sourcepub fn clear_cpu_placement(self) -> Self
pub fn clear_cpu_placement(self) -> Self
Remove cpu_placement from this patch so applying it leaves the target unchanged.
Sourcepub fn clear_cpu_placement_mut(&mut self) -> &mut Self
pub fn clear_cpu_placement_mut(&mut self) -> &mut Self
Remove cpu_placement from this patch so applying it leaves the target unchanged.
Mutates this patch in place and returns it for chaining.
Sourcepub fn clear_placement_profile(self) -> Self
pub fn clear_placement_profile(self) -> Self
Remove placement_profile from this patch so applying it leaves the target unchanged.
Sourcepub fn clear_placement_profile_mut(&mut self) -> &mut Self
pub fn clear_placement_profile_mut(&mut self) -> &mut Self
Remove placement_profile from this patch so applying it leaves the target unchanged.
Mutates this patch in place and returns it for chaining.
Sourcepub fn clear_thp(self) -> Self
pub fn clear_thp(self) -> Self
Remove thp from this patch so applying it leaves the target unchanged.
Sourcepub fn clear_thp_mut(&mut self) -> &mut Self
pub fn clear_thp_mut(&mut self) -> &mut Self
Remove thp from this patch so applying it leaves the target unchanged.
Mutates this patch in place and returns it for chaining.
Sourcepub fn overlay(self, higher: Self) -> Self
pub fn overlay(self, higher: Self) -> Self
Overlay a higher-precedence patch using each field’s declared strategy.
Sourcepub fn overlay_mut(&mut self, higher: Self) -> &mut Self
pub fn overlay_mut(&mut self, higher: Self) -> &mut Self
Overlay a higher-precedence patch using each field’s declared strategy. Mutates this patch in place and returns it for chaining.
Sourcepub fn apply_to(self, target: &mut SandboxResources)
pub fn apply_to(self, target: &mut SandboxResources)
Apply every present field to an existing value.
Sourcepub fn into_config(self) -> SandboxResources
pub fn into_config(self) -> SandboxResources
Apply this patch to the configuration’s defaults.
Compose all overlays first. This conversion does not validate the result.
Sourcepub fn from_present_fields(value: SandboxResources) -> Self
pub fn from_present_fields(value: SandboxResources) -> Self
Convert non-null fields into a changeset, treating Option::None as absent.
Source§impl SandboxResourcesPatch
impl SandboxResourcesPatch
Sourcepub fn has_cpus(&self) -> bool
pub fn has_cpus(&self) -> bool
Whether this patch explicitly sets the initial vCPU count, even to its default value.
Sourcepub fn has_memory_mib(&self) -> bool
pub fn has_memory_mib(&self) -> bool
Whether this patch explicitly sets initial memory, even to its default value.
Sourcepub fn has_max_cpus(&self) -> bool
pub fn has_max_cpus(&self) -> bool
Whether this patch explicitly sets the maximum vCPU count.
Sourcepub fn has_max_memory_mib(&self) -> bool
pub fn has_max_memory_mib(&self) -> bool
Whether this patch explicitly sets maximum memory.