swc_allocator/allocators/
scoped.rs

1/// Scoped allocator
2pub struct Scoped;
3
4#[cfg(feature = "nightly")]
5unsafe impl std::alloc::Allocator for Scoped {
6    fn allocate(
7        &self,
8        _layout: std::alloc::Layout,
9    ) -> Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError> {
10        todo!()
11    }
12
13    unsafe fn deallocate(&self, _ptr: std::ptr::NonNull<u8>, _layout: std::alloc::Layout) {
14        todo!()
15    }
16}
17
18#[cfg(not(feature = "nightly"))]
19unsafe impl allocator_api2::alloc::Allocator for Scoped {
20    fn allocate(
21        &self,
22        _layout: std::alloc::Layout,
23    ) -> Result<std::ptr::NonNull<[u8]>, allocator_api2::alloc::AllocError> {
24        todo!()
25    }
26
27    unsafe fn deallocate(&self, _ptr: std::ptr::NonNull<u8>, _layout: std::alloc::Layout) {
28        todo!()
29    }
30}