1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
use crate::{InnerPool, PoolValue};
#[derive(Debug)]
pub struct Factory<T: 'static> {
inner: *mut InnerPool<T>,
}
impl<T> Factory<T> {
pub(crate) fn new(inner: *mut InnerPool<T>) -> Self {
Self { inner }
}
pub fn alloc(&self, value: T) -> PoolValue<T> {
let inner_ref = unsafe { self.inner.as_ref().unwrap() };
inner_ref.alloc(value)
}
}