What Is the Turbofish Syntax (

:<>) in Rust?

The turbofish syntax `::<Type>` explicitly tells Rust which generic type to use when the compiler cannot infer it automatically.

The turbofish syntax ::<Type> explicitly specifies generic type arguments for a function or method when the compiler cannot infer them. Use it immediately after the function name or receiver to resolve ambiguity in generic contexts.

let v: Vec<i32> = Vec::new();
let s: String = String::from("hello");
let len = v.len::<i32>(); // Explicitly specifying type if needed

In practice, you often see it with methods on generic types like Vec or Option when calling methods that return generic types where the return type isn't obvious from the context.