pub struct ResourceAllocator { /* private fields */ }Expand description
Resource allocator
Implementations§
Source§impl ResourceAllocator
impl ResourceAllocator
pub fn new() -> Self
Sourcepub fn allocate(
&mut self,
device_id: &str,
units: u32,
duration: Duration,
) -> u32
pub fn allocate( &mut self, device_id: &str, units: u32, duration: Duration, ) -> u32
Try to allocate compute units for a task, recording the allocation.
Returns the number of compute units actually granted (may be less than requested if the pool is exhausted). Returns 0 if no units are available.
Sourcepub fn release(&mut self, units: u32)
pub fn release(&mut self, units: u32)
Release previously-allocated compute units back to the pool.
Sourcepub fn available_compute_units(&self) -> u32
pub fn available_compute_units(&self) -> u32
Get the current available compute units in the pool.
Sourcepub fn recent_allocations(&self, n: usize) -> &[AllocationRecord]
pub fn recent_allocations(&self, n: usize) -> &[AllocationRecord]
Get a summary of allocation history (most recent N records).
Auto Trait Implementations§
impl Freeze for ResourceAllocator
impl RefUnwindSafe for ResourceAllocator
impl Send for ResourceAllocator
impl Sync for ResourceAllocator
impl Unpin for ResourceAllocator
impl UnsafeUnpin for ResourceAllocator
impl UnwindSafe for ResourceAllocator
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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