use crate::error::Error;
use std::alloc::Layout;
use std::ptr::NonNull;
pub mod access;
pub mod api;
pub mod marker;
pub use access::*;
pub use api::*;
pub use marker::*;
pub trait Alloc<T: ?Sized>: Sized {
type MutTy;
type RawHandle: Sized;
type Flags;
unsafe fn try_alloc_layout(&mut self, layout: Layout) -> Result<Self::RawHandle, Error>;
unsafe fn handle_ptr(&self, handle: &Self::RawHandle) -> NonNull<u8>;
unsafe fn handle_ref(&self, handle: &Self::RawHandle) -> &T;
}
pub trait AllocMut<T: ?Sized>: Alloc<T> + Alloc<<Self as Alloc<T>>::MutTy> {
type RawHandle: Sized;
}
impl<T: ?Sized, A> AllocMut<T> for A
where
A: Alloc<T> + Alloc<<Self as Alloc<T>>::MutTy>,
{
type RawHandle = <A as Alloc<<A as Alloc<T>>::MutTy>>::RawHandle;
}