Skip to main content

ExternalAllocation

Trait ExternalAllocation 

Source
pub unsafe trait ExternalAllocation: Send + 'static {
    // Required methods
    fn pointer(&self) -> NonNull<u8>;
    fn capacity(&self) -> usize;
}
Expand description

Memory from the application’s own pool, lent to the SDK for one frame.

The value is dropped, on whichever thread the SDK frees the frame from, when the SDK no longer needs the memory. See the ReceiveAllocator callback contract.

§Safety

From creation until the value is dropped:

  • pointer and capacity never change;
  • the memory is initialized, writable from any thread, addressable by the CPU, aligned to at least 64 bytes and valid for capacity bytes;
  • nothing else reads, writes, frees or remaps it.

Dropping the value must not panic.

Required Methods§

Source

fn pointer(&self) -> NonNull<u8>

The start of the memory.

Source

fn capacity(&self) -> usize

The size of the memory in bytes.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§