#[repr(C)]
pub struct rcutils_allocator_t { pub allocate: Option<unsafe extern "C" fn(size: usize, state: *mut c_void) -> *mut c_void>, pub deallocate: Option<unsafe extern "C" fn(pointer: *mut c_void, state: *mut c_void)>, pub reallocate: Option<unsafe extern "C" fn(pointer: *mut c_void, size: usize, state: *mut c_void) -> *mut c_void>, pub zero_allocate: Option<unsafe extern "C" fn(number_of_elements: usize, size_of_element: usize, state: *mut c_void) -> *mut c_void>, pub state: *mut c_void, }
Expand description

Encapsulation of an allocator.

Fields

allocate: Option<unsafe extern "C" fn(size: usize, state: *mut c_void) -> *mut c_void>

Allocate memory, given a size and the state pointer.

deallocate: Option<unsafe extern "C" fn(pointer: *mut c_void, state: *mut c_void)>

Deallocate previously allocated memory, mimicking free().

reallocate: Option<unsafe extern "C" fn(pointer: *mut c_void, size: usize, state: *mut c_void) -> *mut c_void>

Reallocate if possible, otherwise it deallocates and allocates.

zero_allocate: Option<unsafe extern "C" fn(number_of_elements: usize, size_of_element: usize, state: *mut c_void) -> *mut c_void>

Allocate memory with all elements set to zero, given a number of elements and their size.

state: *mut c_void

Implementation defined state storage.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.