pub struct ResourceRequirement {
pub resource_type: ResourceType,
pub minimum: ResourceAmount,
pub recommended: Option<ResourceAmount>,
pub maximum: Option<ResourceAmount>,
pub preferred_vendor: Option<String>,
pub constraints: Vec<ResourceConstraint>,
pub is_critical: bool,
pub weight: f64,
}Expand description
Resource requirement specification
Fields§
§resource_type: ResourceTypeType of resource
minimum: ResourceAmountMinimum required level/amount
recommended: Option<ResourceAmount>Recommended level/amount
maximum: Option<ResourceAmount>Maximum useful level/amount
preferred_vendor: Option<String>Preferred vendor/technology
constraints: Vec<ResourceConstraint>Additional constraints
is_critical: boolWhether this requirement is critical
weight: f64Importance weight (0.0 to 1.0)
Implementations§
Source§impl ResourceRequirement
impl ResourceRequirement
Sourcepub fn new(resource_type: ResourceType) -> Self
pub fn new(resource_type: ResourceType) -> Self
Create a new resource requirement
Sourcepub fn minimum_gb(self, gb: f64) -> Self
pub fn minimum_gb(self, gb: f64) -> Self
Set minimum amount in GB (for memory/storage)
Sourcepub fn recommended_gb(self, gb: f64) -> Self
pub fn recommended_gb(self, gb: f64) -> Self
Set recommended amount in GB (for memory/storage)
Sourcepub fn maximum_gb(self, gb: f64) -> Self
pub fn maximum_gb(self, gb: f64) -> Self
Set maximum amount in GB (for memory/storage)
Sourcepub fn minimum_level(self, level: CapabilityLevel) -> Self
pub fn minimum_level(self, level: CapabilityLevel) -> Self
Set minimum capability level
Sourcepub fn recommended_level(self, level: CapabilityLevel) -> Self
pub fn recommended_level(self, level: CapabilityLevel) -> Self
Set recommended capability level
Sourcepub fn maximum_level(self, level: CapabilityLevel) -> Self
pub fn maximum_level(self, level: CapabilityLevel) -> Self
Set maximum capability level
Sourcepub fn minimum_score(self, score: f64) -> Self
pub fn minimum_score(self, score: f64) -> Self
Set minimum score (0-10)
Sourcepub fn recommended_score(self, score: f64) -> Self
pub fn recommended_score(self, score: f64) -> Self
Set recommended score (0-10)
Sourcepub fn preferred_vendor(self, vendor: Option<impl Into<String>>) -> Self
pub fn preferred_vendor(self, vendor: Option<impl Into<String>>) -> Self
Set preferred vendor
Sourcepub fn add_constraint(self, constraint: ResourceConstraint) -> Self
pub fn add_constraint(self, constraint: ResourceConstraint) -> Self
Add a constraint
Sourcepub fn minimum_ghz(self, ghz: f64) -> Self
pub fn minimum_ghz(self, ghz: f64) -> Self
Set minimum GHz (for CPU)
Sourcepub fn gpu_memory_gb(self, gb: f64) -> Self
pub fn gpu_memory_gb(self, gb: f64) -> Self
Set GPU memory requirement
Sourcepub fn storage_type(self, storage_type: String) -> Self
pub fn storage_type(self, storage_type: String) -> Self
Set storage type
Sourcepub fn minimum_mbps(self, mbps: f64) -> Self
pub fn minimum_mbps(self, mbps: f64) -> Self
Set minimum Mbps (for network)
Sourcepub fn is_satisfied_by(&self, amount: &ResourceAmount) -> bool
pub fn is_satisfied_by(&self, amount: &ResourceAmount) -> bool
Check if a resource amount meets this requirement
Sourcepub fn get_gap(&self, available: &ResourceAmount) -> Option<ResourceGap>
pub fn get_gap(&self, available: &ResourceAmount) -> Option<ResourceGap>
Get the gap between available and required resources
Trait Implementations§
Source§impl Clone for ResourceRequirement
impl Clone for ResourceRequirement
Source§fn clone(&self) -> ResourceRequirement
fn clone(&self) -> ResourceRequirement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResourceRequirement
impl Debug for ResourceRequirement
Source§impl<'de> Deserialize<'de> for ResourceRequirement
impl<'de> Deserialize<'de> for ResourceRequirement
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>,
Auto Trait Implementations§
impl Freeze for ResourceRequirement
impl RefUnwindSafe for ResourceRequirement
impl Send for ResourceRequirement
impl Sync for ResourceRequirement
impl Unpin for ResourceRequirement
impl UnwindSafe for ResourceRequirement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more