pub fn unlink_free_frame(&mut self, position: usize) -> Result<usize, Box<dyn Error>> {
        let mut cursor: usize = self.header.first_free_frame;
        let mut prev: Option<Frame> = None;
        while cursor != 0 {
            let frame = self.read_frame(cursor)?;
            if frame.position == position {
                if let Some(mut prev) = prev {
                    prev.next = frame.next;
                    self.update_frame(prev)?;
                    break;
                } else {
                    self.header.first_free_frame = frame.next;
                    self.header.update(&mut self.mapped_file)?;
                    break;
                }
            } else {
                cursor = frame.next;
                prev = Some(frame);
            }
        }
        Ok(position)
    }
/// remove a frame from the list of deleted frames, making it an orphan.
///
/// this should be used with great care, since this memory frame will never
/// be reclaimed again if not used immediately.
remove a frame from the list of deleted frames, making it an orphan.
this should be used with great care, since this memory frame will never
be reclaimed again if not used immediately.
remove a frame from the list of deleted frames making it an orphan . this should be used with great care since this memory frame will never be reclaimed again if not used immediately .
pub fn unlink_free_frame(&mut self, position: usize) -> Result<usize, Box<dyn Error>> {
        let mut cursor: usize = self.header.first_free_frame;
        let mut prev: Option<Frame> = None;
        while cursor != 0 {
            let frame = self.read_frame(cursor)?;
            if frame.position == position {
                if let Some(mut prev) = prev {
                    prev.next = frame.next;
                    self.update_frame(prev)?;
                    break;
                } else {
                    self.header.first_free_frame = frame.next;
                    self.header.update(&mut self.mapped_file)?;
                    break;
                }
            } else {
                cursor = frame.next;
                prev = Some(frame);
            }
        }
        Ok(position)
    }
pub fn unlink_free_frame ( & mut self , position : usize ) -> Result < usize , Box < dyn Error > > { let mut cursor : usize = self . header . first_free_frame ; let mut prev : Option < Frame > = None ; while cursor != 0 { let frame = self . read_frame ( cursor ) ? ; if frame . position == position { if let Some ( mut prev ) = prev { prev . next = frame . next ; self . update_frame ( prev ) ? ; break ; } else { self . header . first_free_frame = frame . next ; self . header . update ( & mut self . mapped_file ) ? ; break ; } } else { cursor = frame . next ; prev = Some ( frame ) ; } } Ok ( position ) }
remove a frame from the list of deleted frames, making it an orphan.
remove a frame from the list of deleted frames making it an orphan .
&mut self
position
usize
&mut self
position
usize