Skip to main content

ExternalPool

Trait ExternalPool 

Source
pub unsafe trait ExternalPool:
    Send
    + Sync
    + 'static {
    // Required method
    unsafe fn release(&self, block: PoolBlock);
}
Expand description

A pool that reclaims exclusive blocks lent through AllocationBuffer::from_pool.

§Safety

For each valid loan, the pool must keep its initialized, CPU-addressable, 64-byte-aligned memory stable and valid for the block’s capacity until release, with no other access, remapping or reclamation. Release must not panic. It and the pool’s last destructor may run on any SDK free thread, or on the SDK’s allocating thread when publication refuses a block, without registry locks. The ReceiveAllocator callback contract also covers release during a connection change. See ExternalAllocation for the equivalent arbitrary-handle contract.

Required Methods§

Source

unsafe fn release(&self, block: PoolBlock)

Return a block after the SDK’s exclusive access has ended, or after publication refused it before any SDK access.

§Safety

The block must name one unreleased loan from this pool. Its SDK access must have ended, and this call must be the only release of that loan.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§