pub struct LocalBlindPooled<T: ?Sized> { /* private fields */ }Expand description
A shared single-threaded reference-counting handle for a pooled object.
§Implications of reference counted handles
The handle can be used to access the pooled object.
This is a reference-counted handle that automatically removes the object when the handle is dropped. Dropping the handle is the only way to remove the object from the pool. This is a shared handle that only grants shared access to the object. No exclusive references can be created through this handle.
§Thread safety
This type is single-threaded.
Implementations§
Source§impl<T: ?Sized> LocalBlindPooled<T>
impl<T: ?Sized> LocalBlindPooled<T>
Sourcepub fn ptr(&self) -> NonNull<T>
pub fn ptr(&self) -> NonNull<T>
Get a pointer to the target object.
All pooled objects are guaranteed to be pinned for their entire lifetime, so this pointer remains valid for as long as the object remains in the pool.
The object pool implementation does not keep any references to the pooled objects, so you have the option of using this pointer to create Rust references directly without fear of any conflicting references created by the pool.
Sourcepub fn as_pin(&self) -> Pin<&T>
pub fn as_pin(&self) -> Pin<&T>
Borrows the target object as a pinned shared reference.
All pooled objects are guaranteed to be pinned for their entire lifetime.
Sourcepub fn erase(self) -> LocalBlindPooled<()>
pub fn erase(self) -> LocalBlindPooled<()>
Erase the type information from this handle, converting it to LocalBlindPooled<()>.
This is useful for extending the lifetime of an object in the pool without retaining type information. The type-erased handle prevents access to the object but ensures it remains in the pool.