Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch genome name lookup to hashmap #40

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

AroneyS
Copy link
Collaborator

@AroneyS AroneyS commented Nov 30, 2023

I had a go, but I can't work out this compiler error:

   Compiling galah v0.3.1 (/mnt/hpccs01/home/aroneys/src/galah)
error[E0277]: the trait bound `&&str: Borrow<std::string::String>` is not satisfied
  --> src/skani.rs:83:52
   |
83 |                 let ref_index = genome_indices.get(&ref_sketch.file_name).unwrap();
   |                                                --- ^^^^^^^^^^^^^^^^^^^^^ the trait `Borrow<std::string::String>` is not implemented for `&&str`
   |                                                |
   |                                                required by a bound introduced by this call
   |
   = help: the trait `Borrow<str>` is implemented for `std::string::String`
note: required by a bound in `HashMap::<K, V, S>::get`
  --> /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/collections/hash/map.rs:876:5

error[E0277]: the trait bound `&&str: Borrow<std::string::String>` is not satisfied
  --> src/skani.rs:84:54
   |
84 |                 let query_index = genome_indices.get(&query_name).unwrap();
   |                                                  --- ^^^^^^^^^^^ the trait `Borrow<std::string::String>` is not implemented for `&&str`
   |                                                  |
   |                                                  required by a bound introduced by this call
   |
   = help: the trait `Borrow<str>` is implemented for `std::string::String`
note: required by a bound in `HashMap::<K, V, S>::get`
  --> /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/collections/hash/map.rs:876:5

For more information about this error, try `rustc --explain E0277`.
error: could not compile `galah` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `galah` (lib test) due to 2 previous errors

@AroneyS AroneyS requested a review from wwood November 30, 2023 00:24
@wwood
Copy link
Owner

wwood commented Nov 30, 2023

Maybe just use string from

@@ -78,14 +80,8 @@ fn precluster_skani(
let query_name = sketches[j].file_name.clone();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wwood I tried using String::from(ref_sketch.file_name) and String::from(ref_sketch.file_name.clone()) but get the same error. Did you mean somewhere else?

@wwood
Copy link
Owner

wwood commented Nov 30, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants