fn insert_into(&mut self, page: PageId, datoms: &[Datom]) -> io::Result<VecNode>
    where Store: store::StoreMut
    {
        // Make a heap-allocated copy of the node to insert into, and merge-sort
        // insert the datoms into it.
        let mut new_node = get_node(&self.store, page).insert(&self.comparator, &self.heap, datoms);

        // If the new node does not fit in a page, try flushing pending datoms
        // until it fits.
        while new_node.level > 0
            && new_node.datoms.len() > Store::Size::CAPACITY
            && new_node.as_node().has_pending_datoms()
        {
            self.flush(&mut new_node)?;
        }

        // If flushing did not help (enough), then we need to split the node.
        if new_node.datoms.len() > Store::Size::CAPACITY {
            assert!(
                !new_node.as_node().has_pending_datoms() || new_node.level == 0,
                "Only at level 0, an oversized node can have pending datoms.",
            );
            return self.split(&new_node.as_node());
        }

        // If the node is small enough to fit in one page, then we just write
        // the new node, and return its id as the sole child of a `VecNode`.
        // (A `VecNode` with more children is only returned if we do splits.)
        let new_page_id = self.store.write_page(&new_node.as_node().write::<Store::Size>())?;

        let result = VecNode {
            level: new_node.level + 1,
            datoms: vec![],
            children: vec![new_page_id],
        };

        Ok(result)
    }
/// Insert datoms into a given node.
///
/// Inserting into a node may cause the subtree to overflow, requiring node
/// splits. The midpoints for these splits need to be pushed up one level,
/// so they are returned from the insert.
///
/// The last child of the returned node contains the page id of the new
/// node, where the datoms have been inserted. If the insert required
/// splits, then the midpoint datoms and associated page ids precede the
/// final child, respecting the ordering.
///
/// Note that the returned `VecNode` might contain more datoms than would
/// fit in a page, it may need to be split further to become writeable.
Insert datoms into a given node.
Inserting into a node may cause the subtree to overflow, requiring node
splits. The midpoints for these splits need to be pushed up one level,
so they are returned from the insert.

The last child of the returned node contains the page id of the new
node, where the datoms have been inserted. If the insert required
splits, then the midpoint datoms and associated page ids precede the
final child, respecting the ordering.

Note that the returned `VecNode` might contain more datoms than would
fit in a page, it may need to be split further to become writeable.
Insert datoms into a given node . Inserting into a node may cause the subtree to overflow requiring node splits . The midpoints for these splits need to be pushed up one level so they are returned from the insert . The last child of the returned node contains the page id of the new node where the datoms have been inserted . If the insert required splits then the midpoint datoms and associated page ids precede the final child respecting the ordering . Note that the returned ` VecNode ` might contain more datoms than would fit in a page it may need to be split further to become writeable .
fn insert_into(&mut self, page: PageId, datoms: &[Datom]) -> io::Result<VecNode>
    where Store: store::StoreMut
    {
        // Make a heap-allocated copy of the node to insert into, and merge-sort
        // insert the datoms into it.
        let mut new_node = get_node(&self.store, page).insert(&self.comparator, &self.heap, datoms);
        // If the new node does not fit in a page, try flushing pending datoms
        // until it fits.
        while new_node.level > 0
            && new_node.datoms.len() > Store::Size::CAPACITY
            && new_node.as_node().has_pending_datoms()
        {
            self.flush(&mut new_node)?;
        }
        // If flushing did not help (enough), then we need to split the node.
        if new_node.datoms.len() > Store::Size::CAPACITY {
            assert!(
                !new_node.as_node().has_pending_datoms() || new_node.level == 0,
                "Only at level 0, an oversized node can have pending datoms.",
            );
            return self.split(&new_node.as_node());
        }
        // If the node is small enough to fit in one page, then we just write
        // the new node, and return its id as the sole child of a `VecNode`.
        // (A `VecNode` with more children is only returned if we do splits.)
        let new_page_id = self.store.write_page(&new_node.as_node().write::<Store::Size>())?;
        let result = VecNode {
            level: new_node.level + 1,
            datoms: vec![],
            children: vec![new_page_id],
        };
        Ok(result)
    }
fn insert_into ( & mut self , page : PageId , datoms : & [ Datom ] ) -> io :: Result < VecNode > where Store : store :: StoreMut { // Make a heap-allocated copy of the node to insert into, and merge-sort // insert the datoms into it. let mut new_node = get_node ( & self . store , page ) . insert ( & self . comparator , & self . heap , datoms ) ; // If the new node does not fit in a page, try flushing pending datoms // until it fits. while new_node . level > 0 && new_node . datoms . len ( ) > Store :: Size :: CAPACITY && new_node . as_node ( ) . has_pending_datoms ( ) { self . flush ( & mut new_node ) ? ; } // If flushing did not help (enough), then we need to split the node. if new_node . datoms . len ( ) > Store :: Size :: CAPACITY { assert ! ( new_node as_node ( ) has_pending_datoms ( ) new_node level 0 " " ) ; return self . split ( & new_node . as_node ( ) ) ; } // If the node is small enough to fit in one page, then we just write // the new node, and return its id as the sole child of a `VecNode`. // (A `VecNode` with more children is only returned if we do splits.) let new_page_id = self . store . write_page ( & new_node . as_node ( ) . write :: < Store :: Size > ( ) ) ? ; let result = VecNode { level : new_node . level + 1 , datoms : vec ! [ ] , children : vec ! [ new_page_id ] , } ; Ok ( result ) }
Insert datoms into a given node.
Insert datoms into a given node .
&mut self
page
PageId
datoms
&[Datom]
&mut self
page
PageId
datoms
&[Datom]