pub struct PooledInstance<T, E>{ /* private fields */ }Expand description
RAII handle to an instance acquired from an InstancePool.
Holds the fresh instance and frees its concurrency slot on drop (dropping the instance — never recycling it). Adapters use this to make “acquire-call-drop” exception-safe: if the plugin call panics or traps, the slot still frees and the (possibly poisoned) instance is discarded.
Implementations§
Source§impl<T, E> PooledInstance<T, E>
impl<T, E> PooledInstance<T, E>
Sourcepub fn acquire(pool: Arc<InstancePool<T, E>>) -> Result<Self, E>
pub fn acquire(pool: Arc<InstancePool<T, E>>) -> Result<Self, E>
Sourcepub fn take(self) -> T
pub fn take(self) -> T
Consume the wrapper, returning the inner instance without freeing its concurrency slot via the pool.
Retained for API compatibility. With per-invoke instances there is
no “corrupted vs clean” distinction at the pool level (a dropped
instance is always discarded), but take still moves the instance
out and decrements the live counter so callers that need ownership
keep working.
Trait Implementations§
Source§impl<T, E> Debug for PooledInstance<T, E>
impl<T, E> Debug for PooledInstance<T, E>
Source§impl<T, E> Drop for PooledInstance<T, E>
impl<T, E> Drop for PooledInstance<T, E>
Auto Trait Implementations§
impl<T, E> !RefUnwindSafe for PooledInstance<T, E>
impl<T, E> !UnwindSafe for PooledInstance<T, E>
impl<T, E> Freeze for PooledInstance<T, E>where
T: Freeze,
impl<T, E> Send for PooledInstance<T, E>
impl<T, E> Sync for PooledInstance<T, E>where
T: Sync,
impl<T, E> Unpin for PooledInstance<T, E>where
T: Unpin,
impl<T, E> UnsafeUnpin for PooledInstance<T, E>where
T: UnsafeUnpin,
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