fn vec_subtract(a: &[PackageId], b: &[PackageId]) -> Vec<PackageId> {
            a.iter()
                .filter(|a| {
                    // If this package ID is not found in `b`, then it's definitely
                    // in the subtracted set.
                    let i = match b.binary_search(a) {
                        Ok(i) => i,
                        Err(..) => return true,
                    };

                    // If we've found `a` in `b`, then we iterate over all instances
                    // (we know `b` is sorted) and see if they all have different
                    // precise versions. If so, then `a` isn't actually in `b` so
                    // we'll let it through.
                    //
                    // Note that we only check this for non-registry sources,
                    // however, as registries contain enough version information in
                    // the package ID to disambiguate.
                    if a.source_id().is_registry() {
                        return false;
                    }
                    b[i..]
                        .iter()
                        .take_while(|b| a == b)
                        .all(|b| a.source_id().precise() != b.source_id().precise())
                })
                .cloned()
                .collect()
        }
// Removes all package IDs in `b` from `a`. Note that this is somewhat
// more complicated because the equality for source IDs does not take
// precise versions into account (e.g., git shas), but we want to take
// that into account here.
Removes all package IDs in `b` from `a`. Note that this is somewhat
more complicated because the equality for source IDs does not take
precise versions into account , but we want to take
that into account here.
Removes all package IDs in ` b ` from ` a ` . Note that this is somewhat more complicated because the equality for source IDs does not take precise versions into account but we want to take that into account here .
fn vec_subtract(a: &[PackageId], b: &[PackageId]) -> Vec<PackageId> {
            a.iter()
                .filter(|a| {
                    // If this package ID is not found in `b`, then it's definitely
                    // in the subtracted set.
                    let i = match b.binary_search(a) {
                        Ok(i) => i,
                        Err(..) => return true,
                    };
                    // If we've found `a` in `b`, then we iterate over all instances
                    // (we know `b` is sorted) and see if they all have different
                    // precise versions. If so, then `a` isn't actually in `b` so
                    // we'll let it through.
                    //
                    // Note that we only check this for non-registry sources,
                    // however, as registries contain enough version information in
                    // the package ID to disambiguate.
                    if a.source_id().is_registry() {
                        return false;
                    }
                    b[i..]
                        .iter()
                        .take_while(|b| a == b)
                        .all(|b| a.source_id().precise() != b.source_id().precise())
                })
                .cloned()
                .collect()
        }
fn vec_subtract ( a : & [ PackageId ] , b : & [ PackageId ] ) -> Vec < PackageId > { a . iter ( ) . filter ( | a | { // If this package ID is not found in `b`, then it's definitely // in the subtracted set. let i = match b . binary_search ( a ) { Ok ( i ) => i , Err ( .. ) => return true , } ; // If we've found `a` in `b`, then we iterate over all instances // (we know `b` is sorted) and see if they all have different // precise versions. If so, then `a` isn't actually in `b` so // we'll let it through. // // Note that we only check this for non-registry sources, // however, as registries contain enough version information in // the package ID to disambiguate. if a . source_id ( ) . is_registry ( ) { return false ; } b [ i .. ] . iter ( ) . take_while ( | b | a == b ) . all ( | b | a . source_id ( ) . precise ( ) != b . source_id ( ) . precise ( ) ) } ) . cloned ( ) . collect ( ) }
Removes all package IDs in `b` from `a`.
Removes all package IDs in ` b ` from ` a ` .
a
&[PackageId]
b
&[PackageId]
a
&[PackageId]
b
&[PackageId]