pub fn delete_subregion(&self, child: &Region) -> Result<()> {
        let mut sub_regions = self.subregions.write().unwrap();
        let mut removed = false;
        for (index, sub_r) in sub_regions.iter().enumerate() {
            if child == sub_r {
                sub_regions.remove(index);
                removed = true;
                break;
            }
        }
        drop(sub_regions);

        if !removed {
            warn!("Failed to delete subregion from parent region: not found");
            return Err(ErrorKind::RegionNotFound(child.offset().raw_value()).into());
        }

        // get father address-space and update topology
        if let Some(space) = self.space.read().unwrap().upgrade() {
            space
                .update_topology()
                .chain_err(|| "Failed to update topology for address_space")?;
        } else {
            debug!("add subregion to container region, which has no belonged address-space");
        }
        child.del_belonged_address_space();

        Ok(())
    }
/// Delete sub-region of this region.
///
/// # Arguments
///
/// * `child` - Subregion of this region.
///
/// # Errors
///
/// Return Error if
/// * The child-region does not exist in sub-regions array.
/// * Failed to generate flat view (topology changed after removing sub-region).
Delete sub-region of this region.
Delete sub - region of this region .
pub fn delete_subregion(&self, child: &Region) -> Result<()> {
        let mut sub_regions = self.subregions.write().unwrap();
        let mut removed = false;
        for (index, sub_r) in sub_regions.iter().enumerate() {
            if child == sub_r {
                sub_regions.remove(index);
                removed = true;
                break;
            }
        }
        drop(sub_regions);
        if !removed {
            warn!("Failed to delete subregion from parent region: not found");
            return Err(ErrorKind::RegionNotFound(child.offset().raw_value()).into());
        }
        // get father address-space and update topology
        if let Some(space) = self.space.read().unwrap().upgrade() {
            space
                .update_topology()
                .chain_err(|| "Failed to update topology for address_space")?;
        } else {
            debug!("add subregion to container region, which has no belonged address-space");
        }
        child.del_belonged_address_space();
        Ok(())
    }
pub fn delete_subregion ( & self , child : & Region ) -> Result < ( ) > { let mut sub_regions = self . subregions . write ( ) . unwrap ( ) ; let mut removed = false ; for ( index , sub_r ) in sub_regions . iter ( ) . enumerate ( ) { if child == sub_r { sub_regions . remove ( index ) ; removed = true ; break ; } } drop ( sub_regions ) ; if ! removed { warn ! ( " " ) ; return Err ( ErrorKind :: RegionNotFound ( child . offset ( ) . raw_value ( ) ) . into ( ) ) ; } // get father address-space and update topology if let Some ( space ) = self . space . read ( ) . unwrap ( ) . upgrade ( ) { space . update_topology ( ) . chain_err ( | | " " ) ? ; } else { debug ! ( " " ) ; } child . del_belonged_address_space ( ) ; Ok ( ( ) ) }
Delete sub-region of this region.
Delete sub - region of this region .
&self
child
&Region
&self
child
&Region
errors
Return Error if
The child-region does not exist in sub-regions array.
Failed to generate flat view (topology changed after removing sub-region).
Return Error if The child - region does not exist in sub - regions array . Failed to generate flat view ( topology changed after removing sub - region ) .