Crate malloc_bind [] [src]

Bindings for the C malloc API to Rust allocators.

This crate provides a mechanism to construct a C allocator - an implementation of malloc, free, and related functions - that is backed by a Rust allocator (an implementation of the Alloc trait).

In order to create bindings, two things must be provided: an implementation of the Alloc trait, and an implementation of the LayoutFinder trait (defined in this crate). Since the C API does not provide size or alignment on free, but the Rust Alloc API requires both size and alignment on dealloc, a mapping must be maintained between allocated objects and those objects' size and alignment. The LayoutFinder provides this functionality.

Reexports

pub use lazy_static::*;

Macros

define_malloc

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

define_malloc_lazy_static

Define extern "C" functions for the C allocation API with non-constant initializers.

lazy_static

Structs

Malloc

A wrapper for a Rust allocator providing C bindings.

Traits

LayoutFinder

A mechanism for mapping allocated objects to their Layouts.