use crate::local_alloc::ThreadAllocator;
use mnemosyne_arena::HasSegmentPool;
pub trait PolicySlotSelection<B: HasSegmentPool> {
fn with_allocator<R>(f: impl FnOnce(&mut ThreadAllocator<B>) -> R) -> Option<R>;
unsafe fn with_allocator_unguarded<R>(
f: impl FnOnce(&mut ThreadAllocator<B>) -> R,
) -> Option<R>;
fn get_allocator_ptr() -> *mut core::ffi::c_void;
fn get_allocator_ptr_raw() -> *mut core::ffi::c_void;
}
pub trait LocalAllocatorSelector<B: HasSegmentPool>: HasSegmentPool {
fn with_allocator<R>(f: impl FnOnce(&mut ThreadAllocator<B>) -> R) -> Option<R>;
unsafe fn with_allocator_unguarded<R>(
f: impl FnOnce(&mut ThreadAllocator<B>) -> R,
) -> Option<R>;
fn get_allocator_ptr() -> *mut core::ffi::c_void;
fn get_allocator_ptr_raw() -> *mut core::ffi::c_void;
fn register_current_allocator_ptr(ptr: *mut core::ffi::c_void);
fn with_allocator_for_policy<P, R>(f: impl FnOnce(&mut ThreadAllocator<B>) -> R) -> Option<R>
where
P: mnemosyne_core::AllocPolicy + PolicySlotSelection<B>;
unsafe fn with_allocator_unguarded_for_policy<P, R>(
f: impl FnOnce(&mut ThreadAllocator<B>) -> R,
) -> Option<R>
where
P: mnemosyne_core::AllocPolicy + PolicySlotSelection<B>;
fn get_allocator_ptr_for_policy<P>() -> *mut core::ffi::c_void
where
P: mnemosyne_core::AllocPolicy + PolicySlotSelection<B>;
fn get_allocator_ptr_raw_for_policy<P>() -> *mut core::ffi::c_void
where
P: mnemosyne_core::AllocPolicy + PolicySlotSelection<B>;
fn get_allocator_ptr_raw_for_encryption<const ENCRYPTED: bool>() -> *mut core::ffi::c_void;
}