fn remove_child(&mut self, child: &WeakRef) {
        // a child slice do not have to belong to a hidden parent
        if !self.type_.is_hidden() {
            return;
        }
        let (tag, other_child) = self.type_.get_tag_and_other(child);
        let arc_child = other_child.upgrade().unwrap();
        let mut child = arc_child.inner.borrow_mut();
        let start = child.parent_offset / PAGE_SIZE;
        let end = child.parent_limit / PAGE_SIZE;
        // merge nodes to the child
        for (key, mut value) in core::mem::take(&mut self.frames) {
            if key < start || key >= end {
                continue;
            }
            if self.contiguous && !child.contiguous && value.pin_count >= 1 {
                value.pin_count -= 1;
            }
            let idx = key - start;
            if !child.frames.contains_key(&idx) && value.tag != tag.negate() {
                value.tag = PageStateTag::Owned;
                child.frames.insert(idx, value);
            }
        }
        // connect child to my parent
        child.parent_offset += self.parent_offset;
        child.parent_limit += self.parent_offset;
        if let Some(parent) = &self.parent {
            parent.inner.borrow_mut().replace_child(
                &self.self_ref,
                self.owner,
                other_child,
                Some((child.parent_offset, child.parent_limit)),
            );
        }
        child.parent = self.parent.take();
    }
/// Remove one child and contract hidden node.
///
/// ```text
///    |         |
///    H         |
///   / \    =>  |
///  A   B       B
///  ^remove
/// ```
Remove one child and contract hidden node.
Remove one child and contract hidden node .
fn remove_child(&mut self, child: &WeakRef) {
        // a child slice do not have to belong to a hidden parent
        if !self.type_.is_hidden() {
            return;
        }
        let (tag, other_child) = self.type_.get_tag_and_other(child);
        let arc_child = other_child.upgrade().unwrap();
        let mut child = arc_child.inner.borrow_mut();
        let start = child.parent_offset / PAGE_SIZE;
        let end = child.parent_limit / PAGE_SIZE;
        // merge nodes to the child
        for (key, mut value) in core::mem::take(&mut self.frames) {
            if key < start || key >= end {
                continue;
            }
            if self.contiguous && !child.contiguous && value.pin_count >= 1 {
                value.pin_count -= 1;
            }
            let idx = key - start;
            if !child.frames.contains_key(&idx) && value.tag != tag.negate() {
                value.tag = PageStateTag::Owned;
                child.frames.insert(idx, value);
            }
        }
        // connect child to my parent
        child.parent_offset += self.parent_offset;
        child.parent_limit += self.parent_offset;
        if let Some(parent) = &self.parent {
            parent.inner.borrow_mut().replace_child(
                &self.self_ref,
                self.owner,
                other_child,
                Some((child.parent_offset, child.parent_limit)),
            );
        }
        child.parent = self.parent.take();
    }
fn remove_child ( & mut self , child : & WeakRef ) { // a child slice do not have to belong to a hidden parent if ! self . type_ . is_hidden ( ) { return ; } let ( tag , other_child ) = self . type_ . get_tag_and_other ( child ) ; let arc_child = other_child . upgrade ( ) . unwrap ( ) ; let mut child = arc_child . inner . borrow_mut ( ) ; let start = child . parent_offset / PAGE_SIZE ; let end = child . parent_limit / PAGE_SIZE ; // merge nodes to the child for ( key , mut value ) in core :: mem :: take ( & mut self . frames ) { if key < start || key >= end { continue ; } if self . contiguous && ! child . contiguous && value . pin_count >= 1 { value . pin_count -= 1 ; } let idx = key - start ; if ! child . frames . contains_key ( & idx ) && value . tag != tag . negate ( ) { value . tag = PageStateTag :: Owned ; child . frames . insert ( idx , value ) ; } } // connect child to my parent child . parent_offset += self . parent_offset ; child . parent_limit += self . parent_offset ; if let Some ( parent ) = & self . parent { parent . inner . borrow_mut ( ) . replace_child ( & self . self_ref , self . owner , other_child , Some ( ( child . parent_offset , child . parent_limit ) ) , ) ; } child . parent = self . parent . take ( ) ; }
Remove one child and contract hidden node.
Remove one child and contract hidden node .
&mut self
child
&WeakRef
&mut self
child
&WeakRef