Skip to content

Switch genome name lookup to hashmap#40

Draft
AroneyS wants to merge 1 commit into
mainfrom
switch-to-hashmap
Draft

Switch genome name lookup to hashmap#40
AroneyS wants to merge 1 commit into
mainfrom
switch-to-hashmap

Conversation

@AroneyS

@AroneyS AroneyS commented Nov 30, 2023

Copy link
Copy Markdown
Collaborator

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

wwood commented Nov 30, 2023

Copy link
Copy Markdown
Owner

Maybe just use string from

Comment thread src/skani.rs
@@ -78,14 +80,8 @@ fn precluster_skani(
let query_name = sketches[j].file_name.clone();

Copy link
Copy Markdown
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

wwood commented Nov 30, 2023

Copy link
Copy Markdown
Owner

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