Skip to content

Commit

Permalink
Merge branch 'latest' of github.com:sourmash-bio/sourmash into debug_…
Browse files Browse the repository at this point in the history
…multisigfile
  • Loading branch information
ctb committed Sep 21, 2024
2 parents 63df7a8 + ada039a commit 7f9c1d1
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/core/src/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,8 @@ impl Collection {
Ok(sig)
}

pub fn intersect_manifest(&self, mf: &Manifest) -> Self {
let manifest = self.manifest.intersect_manifest(mf);
Self {
manifest,
storage: self.storage.clone(),
}
pub fn intersect_manifest(&mut self, mf: &Manifest) {
self.manifest = self.manifest.intersect_manifest(mf);
}
}

Expand All @@ -241,6 +237,7 @@ mod test {
use super::Collection;

use crate::encodings::HashFunctions;
use crate::manifest::Manifest;
use crate::prelude::Select;
use crate::selection::Selection;
use crate::signature::Signature;
Expand Down Expand Up @@ -378,8 +375,7 @@ mod test {
let sigs: Vec<Signature> = serde_json::from_reader(reader).expect("Loading error");
assert_eq!(sigs.len(), 4);
// load sigs into collection + select compatible signatures
let cl = Collection::from_sigs(sigs)
.unwrap();
let mut cl = Collection::from_sigs(sigs).unwrap();
// all sigs should remain
assert_eq!(cl.len(), 4);

Expand All @@ -390,8 +386,8 @@ mod test {

// now intersect:
let manifest2 = Manifest::from(vr);
let cl2 = cl.intersect_manifest(&manifest2);
assert_eq!(cl2.len(), 1);
cl.intersect_manifest(&manifest2);
assert_eq!(cl.len(), 1);
}

#[test]
Expand Down

0 comments on commit 7f9c1d1

Please sign in to comment.