pub struct BlindPooled<T: ?Sized> { /* private fields */ }Expand description
A shared thread-safe reference-counting handle for a pooled object. 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
The handle provides access to the underlying object, so its thread-safety characteristics are determined by the type of the object it points to.
If the underlying object is Sync, the handle is thread-mobile (Send). Otherwise, the
handle is single-threaded (neither Send nor Sync).
Implementations§
Source§impl<T: ?Sized> BlindPooled<T>
impl<T: ?Sized> BlindPooled<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.