pub struct RawBlindPooled<T>where
T: ?Sized,{ /* private fields */ }Expand description
A shared handle to an object in a RawBlindPool.
The handle can be used to access the pooled object, as well as to remove
it from the pool when no longer needed.
This is a raw handle that requires manual lifetime management of the pooled objects.
- Accessing the target object is only possible via unsafe code as the handle does not know when the pool has been dropped - the caller must guarantee the pool still exists.
- You must explicitly remove the target object from the pool when it is no longer needed. If the handle is merely dropped, the object it references remains in the pool until the pool itself is dropped. This is a shared handle that only grants shared access to the object. No exclusive references can be created through this handle. All handles become invalid once the object is removed from the pool or the pool is dropped.
§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> RawBlindPooled<T>
impl<T: ?Sized> RawBlindPooled<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.