1use newer_type::target;
2
3macro_rules! impl_global_alloc {
4 () => {
5 #[target(alternative = ::core::alloc::GlobalAlloc, newer_type = $crate::newer_type, repeater = $crate::Repeater)]
18 pub unsafe trait GlobalAlloc {
19 unsafe fn alloc(&self, layout: ::core::alloc::Layout) -> *mut ::core::primitive::u8;
20
21 unsafe fn dealloc(
22 &self,
23 ptr: *mut ::core::primitive::u8,
24 layout: ::core::alloc::Layout,
25 );
26
27 unsafe fn alloc_zeroed(
28 &self,
29 layout: ::core::alloc::Layout,
30 ) -> *mut ::core::primitive::u8;
31
32 unsafe fn realloc(
33 &self,
34 ptr: *mut ::core::primitive::u8,
35 layout: ::core::alloc::Layout,
36 new_size: ::core::primitive::usize,
37 ) -> *mut ::core::primitive::u8;
38 }
39 };
40}
41
42impl_global_alloc!();