nolock 0.4.1

A collection of Lock-Free Datastructures
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::alloc::GlobalAlloc;

pub trait InternalAlloc
where
    Self: GlobalAlloc,
{
    fn allocate<T>(&self, layout: std::alloc::Layout) -> *mut T {
        (unsafe { GlobalAlloc::alloc(self, layout) } as *mut T)
    }

    fn free<T>(&self, ptr: *mut T, layout: std::alloc::Layout) {
        unsafe { GlobalAlloc::dealloc(self, ptr as *mut u8, layout) };
    }
}

impl InternalAlloc for std::alloc::System {}