/// Safely insert a value into the SmartBuffer
Safely insert a value into the SmartBuffer
Safely insert a value into the SmartBuffer
pub fn insert(&mut self, other: T, index: usize){
        if index < N{ // insert into stack
            self.s_buf[index] = other;
            if index > self.size{
                self.size = index;
            }
        } else if index < self.capacity{ // insert into heap
            unsafe {*((self.d_buf.unwrap() as usize + (index - N) * size_of::<T>()) as *mut T) = other};
            if index > self.size{
                self.size = index;
            }
        }
    }
pub fn insert ( & mut self , other : T , index : usize ) { if index < N { // insert into stack self . s_buf [ index ] = other ; if index > self . size { self . size = index ; } } else if index < self . capacity { // insert into heap unsafe { * ( ( self . d_buf . unwrap ( ) as usize + ( index - N ) * size_of :: < T > ( ) ) as * mut T ) = other } ; if index > self . size { self . size = index ; } } }
Safely insert a value into the SmartBuffer
Safely insert a value into the SmartBuffer
&mut self
other
T
index
usize