pub fn expand(&mut self, amount: usize) -> Result<usize, MemoryError> {
        let old_size = self.allocated_size;
        let new_size = old_size
            .checked_add(amount)
            .ok_or(MemoryError::InvalidRange)?;

        if new_size > self.vma.size {
            Err(MemoryError::InvalidRange)
        } else {
            self.allocated_size = new_size;
            Ok(old_size)
        }
    }
/// Expands the allocated size.
/// Returns the old size on success, an error on failure.
Expands the allocated size.
Returns the old size on success, an error on failure.
Expands the allocated size . Returns the old size on success an error on failure .
pub fn expand(&mut self, amount: usize) -> Result<usize, MemoryError> {
        let old_size = self.allocated_size;
        let new_size = old_size
            .checked_add(amount)
            .ok_or(MemoryError::InvalidRange)?;
        if new_size > self.vma.size {
            Err(MemoryError::InvalidRange)
        } else {
            self.allocated_size = new_size;
            Ok(old_size)
        }
    }
pub fn expand ( & mut self , amount : usize ) -> Result < usize , MemoryError > { let old_size = self . allocated_size ; let new_size = old_size . checked_add ( amount ) . ok_or ( MemoryError :: InvalidRange ) ? ; if new_size > self . vma . size { Err ( MemoryError :: InvalidRange ) } else { self . allocated_size = new_size ; Ok ( old_size ) } }
Expands the allocated size.
Expands the allocated size .
&mut self
amount
usize
&mut self
amount
usize