Hi Deb,
I find it unidiomatic to have containers destroy an item if addition fails. A
more common pattern is to return the item in an error. Something like:
pub(crate) struct AddError<'drm> {
pub(crate) error: Error,
pub(crate) vm: Arc<Vm<'drm>>,
}
This would not convert automatically to Error, so callers could not simply "?"
it, they have to handle it:
pool.add(vm).map_err(|e| {
e.vm.kill();
e.error
})?;
Don't worry, I plan to remove the need to manually call kill() soon, so this
subject will become outdated in the near future.
Paths where the Vm is already in the pool can call kill() though, this includes
remove().
-- Daniel