Macro malloc_bind::define_malloc [] [src]

macro_rules! define_malloc {
    ($alloc_ty:ty, $alloc_new:expr, $layout_finder_ty:ty, $layout_finder_new:expr) => { ... };
}

Define extern "C" functions for the C allocation API.

define_malloc is a convenience macro that constructs a global instance of Malloc and defines each of the functions of the C allocation API by calling methods on that instance. One function is defined for each of the methods on Malloc. Users who only want to define a subset of the C allocation API should instead define these functions manually.

define_malloc takes an allocator type, an expression to construct a new instance of that type, a LayoutFinder type, and an expression to construct a new instance of that type. Both expressions must be constant expressions, as they will be used in the initialization of a static variable.