Skip to main content

WorkerCapacityController

Trait WorkerCapacityController 

Source
pub trait WorkerCapacityController:
    'static
    + Send
    + Sync {
    // Required method
    fn get_pool_size<'life0, 'async_trait>(
        &'life0 mut self,
        current: usize,
    ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Expand description

Controls the size of the worker pool by dynamically growing/shrinking the pool to requested size

Required Methods§

Source

fn get_pool_size<'life0, 'async_trait>( &'life0 mut self, current: usize, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Retrieve the new pool size

  • current - The current pool size

Returns the “new” pool size. If returns 0, adjustment will be ignored

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§