pub fn replace(&mut self, mut other: Self) {
        // Prepopulate missing content blob sets in other from known data in self
        for (old_meta_hash, old_content_hashes) in self.packages.drain() {
            // Skip unpopulated entries.
            let old_content_hashes = match old_content_hashes {
                Some(hashes) => hashes,
                None => continue,
            };

            match other.packages.get_mut(&old_meta_hash) {
                None => {
                    // Package is being removed from the retained index.
                }
                Some(new_content_hashes @ None) => {
                    // We already know the content hashes for this package, move that data into the
                    // new index.
                    *new_content_hashes = Some(old_content_hashes);
                }
                Some(Some(new_content_hashes)) => {
                    // Both indices know the content hashes for this package. They should be the
                    // same.
                    assert_eq!(&old_content_hashes, new_content_hashes);
                }
            }
        }

        *self = other;
    }
/// Replaces this retained index instance with other, populating other's content blob sets
/// using data from `self` when possible.
///
/// # Panics
///
/// Panics if `self` and `other` know of a package's content blobs but disagree as to what they
/// are.
Replaces this retained index instance with other, populating other's content blob sets
using data from `self` when possible.
Replaces this retained index instance with other populating other ' s content blob sets using data from ` self ` when possible .
pub fn replace(&mut self, mut other: Self) {
        // Prepopulate missing content blob sets in other from known data in self
        for (old_meta_hash, old_content_hashes) in self.packages.drain() {
            // Skip unpopulated entries.
            let old_content_hashes = match old_content_hashes {
                Some(hashes) => hashes,
                None => continue,
            };
            match other.packages.get_mut(&old_meta_hash) {
                None => {
                    // Package is being removed from the retained index.
                }
                Some(new_content_hashes @ None) => {
                    // We already know the content hashes for this package, move that data into the
                    // new index.
                    *new_content_hashes = Some(old_content_hashes);
                }
                Some(Some(new_content_hashes)) => {
                    // Both indices know the content hashes for this package. They should be the
                    // same.
                    assert_eq!(&old_content_hashes, new_content_hashes);
                }
            }
        }
        *self = other;
    }
pub fn replace ( & mut self , mut other : Self ) { // Prepopulate missing content blob sets in other from known data in self for ( old_meta_hash , old_content_hashes ) in self . packages . drain ( ) { // Skip unpopulated entries. let old_content_hashes = match old_content_hashes { Some ( hashes ) => hashes , None => continue , } ; match other . packages . get_mut ( & old_meta_hash ) { None => { // Package is being removed from the retained index. } Some ( new_content_hashes @ None ) => { // We already know the content hashes for this package, move that data into the // new index. * new_content_hashes = Some ( old_content_hashes ) ; } Some ( Some ( new_content_hashes ) ) => { // Both indices know the content hashes for this package. They should be the // same. assert_eq ! ( old_content_hashes new_content_hashes ) ; } } } * self = other ; }
Replaces this retained index instance with other, populating other's content blob sets
using data from `self` when possible.
Replaces this retained index instance with other populating other ' s content blob sets using data from ` self ` when possible .
&mut self
other
Self
&mut self
other
Self
panics
Panics if `self` and `other` know of a package's content blobs but disagree as to what they
are.
Panics if ` self ` and ` other ` know of a package ' s content blobs but disagree as to what they are .