use std::num;
use crate::buffer::pool::{self, owners};
mod backing;
pub use backing::Backing;
unsafe impl Backing for owners::Plain {
type Link = ();
}
unsafe impl<const SLOTS: usize, const CAPACITY: usize> Backing
for owners::Plain<pool::Fixed<SLOTS, CAPACITY>>
{
type Link = ();
const SLOTS: Option<u32> = Some(SLOTS as u32);
const CAPACITY: Option<num::NonZero<u32>> = num::NonZero::new(CAPACITY as u32);
}
unsafe impl<const CAPACITY: usize> Backing for owners::Plain<pool::Width<CAPACITY>> {
type Link = ();
const CAPACITY: Option<num::NonZero<u32>> = num::NonZero::new(CAPACITY as u32);
}
unsafe impl<'d> Backing for owners::Resident<'d> {
type Link = std::cell::Cell<u32>;
const COUNTED: bool = true;
unsafe fn release<S>(core: owners::Ptr<Self, S>) {
unsafe { core.uncharge() };
unsafe { core.deallocate() };
}
}