When using the sha2
crate, importing its Digest
trait allows the use of new
to create a new hasher,
use sha2::{Digest, Sha256};
fn main() {
let hasher = Sha256::new();
}
However, there are no type hints or autocompletion for new
. Specifically in VS Code, there is no intellisense when hovering over new
and the type of hasher
is {unknown}
. There are also no autocomplete suggestions when using hasher
.
I was expecting the type of hasher
to be known, and intellisense/autocompletion to work.
Why are they not showing? Are the types not inferrable due to how Digest::new
is defined and how Rust works? Is it a tooling issue with rust-analyzer or VS Code?