Skip to main content

BufferAllocator

Trait BufferAllocator 

Source
pub trait BufferAllocator:
    Send
    + Sync
    + Debug
    + 'static {
    // Required method
    fn free_buffer(&self, range: Range<usize>);

    // Provided methods
    fn identifier(&self) -> usize { ... }
    fn is_trusted(&self) -> bool { ... }
    fn vmo(&self) -> Option<Arc<Vmo>> { ... }
    fn paddrs(&self, _range: &Range<usize>) -> Option<(&[zx_paddr_t], u64)> { ... }
}
Expand description

An entity capable of reclaiming a memory buffer range when dropped.

Required Methods§

Source

fn free_buffer(&self, range: Range<usize>)

Frees or reclaims the specified memory range.

Provided Methods§

Source

fn identifier(&self) -> usize

Returns an identifier for this allocator based on its memory address.

Source

fn is_trusted(&self) -> bool

Returns true if buffers produced by this allocator are trusted (unshared).

Source

fn vmo(&self) -> Option<Arc<Vmo>>

Returns the underlying VMO if backed by a VMO and untrusted.

If the allocator is trusted, this returns None to prevent external modification of memory that is assumed to be unshared.

Source

fn paddrs(&self, _range: &Range<usize>) -> Option<(&[zx_paddr_t], u64)>

Returns the physical addresses for range if pinned, along with the contiguity.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§