pub struct WeakPool<M: Manager, W: From<Object<M>> = Object<M>> { /* private fields */ }Expand description
A weak reference to a Pool<T>, used to avoid keeping the pool alive.
WeakPool<T> is analogous to std::sync::Weak<T> for Pool<T>, and
is typically used in situations where you need a non-owning reference to a pool,
such as in background tasks, managers, or callbacks that should not extend
the lifetime of the pool.
This allows components to retain a reference to the pool while avoiding reference cycles or prolonging its lifetime unnecessarily.
To access the pool, use WeakPool::upgrade to attempt to get a strong reference.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<M, W> Freeze for WeakPool<M, W>
impl<M, W = Object<M>> !RefUnwindSafe for WeakPool<M, W>
impl<M, W> Send for WeakPool<M, W>
impl<M, W> Sync for WeakPool<M, W>
impl<M, W> Unpin for WeakPool<M, W>
impl<M, W = Object<M>> !UnwindSafe for WeakPool<M, W>
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