#[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
Auto Trait Implementations
impl RefUnwindSafe for rcutils_allocator_t
impl !Send for rcutils_allocator_t
impl !Sync for rcutils_allocator_t
impl Unpin for rcutils_allocator_t
impl UnwindSafe for rcutils_allocator_t
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more