I have a function like this:
fn test<F: FnOnce()>(f: F) {
f()
}
and I can call this without offering any generic argument:
test(|| {
println!("It works.")
})
And now I change the function to this:
fn test<const C: bool, F: FnOnce()>(f: F) {
f()
}
And now I have to offer both generic arguments, even though the type of F
can be inffered:
fn main() {
test::<true, _>(|| {
println!("It works.")
})
}
It doesn't look nice to me, and I barely saw any API like this. So is there anyway I can write like this (without the _
), or any kind that allow me to offer only one argument:
test::<true>(|| {
println!("It works.")
})
?