pub struct AvailableResources {
pub cpu_cores: f64,
pub memory_mb: u64,
pub gpus: u32,
pub disk_mb: u64,
pub custom_resources: HashMap<String, f64>,
}Expand description
Available resources at a point in time.
Fields§
§cpu_cores: f64CPU cores available.
memory_mb: u64Memory available in MB.
gpus: u32GPUs available.
disk_mb: u64Disk space available in MB.
custom_resources: HashMap<String, f64>Custom resources available.
Implementations§
Source§impl AvailableResources
impl AvailableResources
Sourcepub fn can_allocate(&self, requirements: &ResourceRequirements) -> bool
pub fn can_allocate(&self, requirements: &ResourceRequirements) -> bool
Check if the required resources can be allocated.
Sourcepub fn allocate(&mut self, requirements: &ResourceRequirements) -> bool
pub fn allocate(&mut self, requirements: &ResourceRequirements) -> bool
Allocate resources.
Sourcepub fn release(&mut self, requirements: &ResourceRequirements)
pub fn release(&mut self, requirements: &ResourceRequirements)
Release resources.
Trait Implementations§
Source§impl Clone for AvailableResources
impl Clone for AvailableResources
Source§fn clone(&self) -> AvailableResources
fn clone(&self) -> AvailableResources
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 AvailableResources
impl Debug for AvailableResources
Source§impl From<ResourcePool> for AvailableResources
impl From<ResourcePool> for AvailableResources
Source§fn from(pool: ResourcePool) -> Self
fn from(pool: ResourcePool) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for AvailableResources
impl RefUnwindSafe for AvailableResources
impl Send for AvailableResources
impl Sync for AvailableResources
impl Unpin for AvailableResources
impl UnsafeUnpin for AvailableResources
impl UnwindSafe for AvailableResources
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