galah
galah copied to clipboard
Switch genome name lookup to hashmap
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
Maybe just use string from
Something along these lines? https://stackoverflow.com/questions/65549983/trait-borrowstring-is-not-implemented-for-str