pub fn insert<'a, IR: IntoRegion<'a>>(
        &mut self,
        region: IR,
        data: ND,
    ) -> Result<(), ShapelikeError> {
        let region = region.into_region().into_owned();

        // If we only have the root node, then set the MBR of the root node to be our input region.
        if self.nodes.len() == 1 {
            // This call is fine because the root node currently has no children.
            self.get_node_mut(self.root)
                .set_minimum_bounding_region_unsafe(region.clone());
        } else {
            // Otherwise extend the MBR of the root node by the input region.
            // This call is fine because the root node has no parents, so we don't need to
            // worry about having inconsistent minimum bounding regions.
            self.get_node_mut(self.root).combine_region_unsafe(&region);
        }

        // The internal `root` node always contains everything.
        self.insert_at_node(region, data, self.root)
    }
/// Attempts to insert a given object into the tree.
///
/// # Errors
/// This function will return an error if `region` does not have the same dimension as this tree.
///
/// # Example
/// ```rust
/// use spaceindex::rtree::RTree;
///
/// let mut tree = RTree::new(2);
/// tree.insert(((-1.0, 0.0), (3.0, 3.0)), 0);
///
/// # tree.validate_consistency();
/// ```
Attempts to insert a given object into the tree.
Attempts to insert a given object into the tree .
pub fn insert<'a, IR: IntoRegion<'a>>(
        &mut self,
        region: IR,
        data: ND,
    ) -> Result<(), ShapelikeError> {
        let region = region.into_region().into_owned();
        // If we only have the root node, then set the MBR of the root node to be our input region.
        if self.nodes.len() == 1 {
            // This call is fine because the root node currently has no children.
            self.get_node_mut(self.root)
                .set_minimum_bounding_region_unsafe(region.clone());
        } else {
            // Otherwise extend the MBR of the root node by the input region.
            // This call is fine because the root node has no parents, so we don't need to
            // worry about having inconsistent minimum bounding regions.
            self.get_node_mut(self.root).combine_region_unsafe(&region);
        }
        // The internal `root` node always contains everything.
        self.insert_at_node(region, data, self.root)
    }
pub fn insert < ' a , IR : IntoRegion < ' a > > ( & mut self , region : IR , data : ND , ) -> Result < ( ) , ShapelikeError > { let region = region . into_region ( ) . into_owned ( ) ; // If we only have the root node, then set the MBR of the root node to be our input region. if self . nodes . len ( ) == 1 { // This call is fine because the root node currently has no children. self . get_node_mut ( self . root ) . set_minimum_bounding_region_unsafe ( region . clone ( ) ) ; } else { // Otherwise extend the MBR of the root node by the input region. // This call is fine because the root node has no parents, so we don't need to // worry about having inconsistent minimum bounding regions. self . get_node_mut ( self . root ) . combine_region_unsafe ( & region ) ; } // The internal `root` node always contains everything. self . insert_at_node ( region , data , self . root ) }
Attempts to insert a given object into the tree.
Attempts to insert a given object into the tree .
&mut self
region
IR
data
ND
&mut self
region
IR
data
ND
errors
This function will return an error if `region` does not have the same dimension as this tree.
This function will return an error if ` region ` does not have the same dimension as this tree .
example
```rust
use spaceindex::rtree::RTree.


` ` ` rust use spaceindex :: rtree :: RTree .
tree.validate_consistency();
None