In Rust, the _
identifier is used when the name does not matter. This occurs in a few situations:
let _ = ...;
is used to ignore the result of an expression (only necessary when said result is marked with the #[must_use]
attribute)
- In types,
_
is used to elide types (either because you prefer to let the compiler infer it or because the compiler judges it does not matter)
Thus, in your case, the compiler has elided the type because it does not matter, so that you can focus on the specific reason of the error. It may be confusing, at first, but once used to it it's actually helpful, especially when types are hairy (very large).
The error is simple: you are mistaking references and values.
Your original signature expects: &(u32, u32, Type)
but you pass &mut (u32, u32, &mut Type)
.
The difference in mutability does not matter (in this direction), however a &mut Type
and a Type
have very different memory structure and are not interchangeable.