pub fn reserve_space(&mut self, size: usize) -> Result<&mut [u8]> {
        let available = self.data_length - self.references * EntryID::SERIALIZED_SIZE;
        let data_bytes =
            unsafe { std::slice::from_raw_parts_mut(self.data_bytes, self.data_length) };
        if size <= available {
            self.data_bytes = unsafe { self.data_bytes.add(size) };
            self.data_length -= size;
            Ok(&mut data_bytes[..size])
        } else {
            Err(SlottedPageError::InsufficientSpace(size, available))
        }
    }
/// Reserves an amount of data bytes from the guard.
Reserves an amount of data bytes from the guard.
Reserves an amount of data bytes from the guard .
pub fn reserve_space(&mut self, size: usize) -> Result<&mut [u8]> {
        let available = self.data_length - self.references * EntryID::SERIALIZED_SIZE;
        let data_bytes =
            unsafe { std::slice::from_raw_parts_mut(self.data_bytes, self.data_length) };
        if size <= available {
            self.data_bytes = unsafe { self.data_bytes.add(size) };
            self.data_length -= size;
            Ok(&mut data_bytes[..size])
        } else {
            Err(SlottedPageError::InsufficientSpace(size, available))
        }
    }
pub fn reserve_space ( & mut self , size : usize ) -> Result < & mut [ u8 ] > { let available = self . data_length - self . references * EntryID :: SERIALIZED_SIZE ; let data_bytes = unsafe { std :: slice :: from_raw_parts_mut ( self . data_bytes , self . data_length ) } ; if size <= available { self . data_bytes = unsafe { self . data_bytes . add ( size ) } ; self . data_length -= size ; Ok ( & mut data_bytes [ .. size ] ) } else { Err ( SlottedPageError :: InsufficientSpace ( size , available ) ) } }
Reserves an amount of data bytes from the guard.
Reserves an amount of data bytes from the guard .
&mut self
size
usize
&mut self
size
usize