Struct malloc_buf::MallocBuffer [-] [+] [src]

pub struct MallocBuffer<T> {
    // some fields omitted
}

A type that represents a malloc'd chunk of memory.

Methods

impl<T: Copy> MallocBuffer<T>

unsafe fn new(ptr: *mut T, len: usize) -> Option<MallocBuffer<T>>

Constructs a new MallocBuffer for a malloc'd buffer with the given length at the given pointer. Returns None if the given pointer is null and the length is not 0.

When this MallocBuffer drops, the buffer will be free'd.

Unsafe because there must be len contiguous, valid instances of T at ptr.

Trait Implementations

impl<T> Deref for MallocBuffer<T>

type Target = [T]

fn deref(&self) -> &[T]