use core::ptr;
use crate::RcCounter;
#[repr(C)]
pub struct RcMeta<TCounter: RcCounter> {
pub vec_ptr: *const u8,
pub capacity: usize,
pub counter: TCounter,
}
impl<TCounter: RcCounter> RcMeta<TCounter> {
pub fn initial(counter: TCounter) -> Self {
Self {
vec_ptr: ptr::null(),
capacity: 0,
counter,
}
}
#[inline]
pub unsafe fn extract_vec(&self, len: usize) -> Vec<u8> {
Vec::from_raw_parts(self.vec_ptr as *mut u8, len, self.capacity)
}
}