#[repr(C)]pub struct CSTL_Alloc {
pub opaque: *mut c_void,
pub aligned_alloc: Option<unsafe extern "C" fn(opaque: *mut c_void, size: usize, alignment: usize) -> *mut c_void>,
pub aligned_free: Option<unsafe extern "C" fn(opaque: *mut c_void, memory: *mut c_void, size: usize, alignment: usize)>,
}Expand description
Opaque memory allocator interface.
The caller is responsible for making sure an allocator owns and is compatible for freeing memory of a given container.
aligned_alloc and aligned_free must not be null, while allocator can
be used to pass any opaque data (if any) directly to the bound functions.
A strict alignment requirement may be imposed by allocated types.
Fields§
§opaque: *mut c_voidPointer to opaque data, passed to bound memory allocation functions.
aligned_alloc: Option<unsafe extern "C" fn(opaque: *mut c_void, size: usize, alignment: usize) -> *mut c_void>Must return a memory block of at least size bytes that is at least
as aligned as alignment
aligned_free: Option<unsafe extern "C" fn(opaque: *mut c_void, memory: *mut c_void, size: usize, alignment: usize)>Must be able to free previously allocated memory.
The caller is responsible for allocator compatibility.
Trait Implementations§
Source§impl Clone for CSTL_Alloc
impl Clone for CSTL_Alloc
Source§fn clone(&self) -> CSTL_Alloc
fn clone(&self) -> CSTL_Alloc
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CSTL_Alloc
impl Debug for CSTL_Alloc
impl Copy for CSTL_Alloc
Auto Trait Implementations§
impl Freeze for CSTL_Alloc
impl RefUnwindSafe for CSTL_Alloc
impl !Send for CSTL_Alloc
impl !Sync for CSTL_Alloc
impl Unpin for CSTL_Alloc
impl UnwindSafe for CSTL_Alloc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more