pub struct MachinePool { /* private fields */ }Implementations§
Source§impl MachinePool
impl MachinePool
Sourcepub async fn add(
&mut self,
name: String,
image: &Image,
config: &MachineConfig,
) -> Result<()>
pub async fn add( &mut self, name: String, image: &Image, config: &MachineConfig, ) -> Result<()>
Add a new machine to the pool.
Sourcepub async fn get(&self, name: &str) -> Option<MutexGuard<'_, Machine>>
pub async fn get(&self, name: &str) -> Option<MutexGuard<'_, Machine>>
Get a mutable reference to a machine by name.
Sourcepub async fn init_all(&mut self) -> Result<()>
pub async fn init_all(&mut self) -> Result<()>
Initialize all machines in the pool concurrently.
This is a short-circuiting method: execution returns immediately upon encountering the first machine initialization error, discarding any remaining tasks.
Sourcepub async fn spawn_all(&mut self) -> Result<()>
pub async fn spawn_all(&mut self) -> Result<()>
Spawn all machines in the pool concurrently.
This is a short-circuiting method: execution returns immediately upon encountering the first machine spawn error, discarding any remaining tasks.
Sourcepub async fn shutdown_all(&mut self) -> Result<()>
pub async fn shutdown_all(&mut self) -> Result<()>
Shutdown all machines in the pool concurrently.
This method collects errors from all shutdown attempts and returns them together.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MachinePool
impl !RefUnwindSafe for MachinePool
impl Send for MachinePool
impl Sync for MachinePool
impl Unpin for MachinePool
impl !UnwindSafe for MachinePool
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