generic

Rust Turbofish syntax

Specify type arguments explicitly in an expression using :: followed by angle brackets. This is helpful when a return type is otherwise ambiguous. Expected output (not executed): 33 Why: The explicit argument selects the parser result type. Common mistake: Writing parse<u32>() in an expression without the required ::.

Formal Syntax & Structure

rust syntaxrust
function::<Type>(arguments)

Working Example

Example Snippetrust
fn main() {    let count = "32".parse::<u32>().expect("valid fixture");    println!("{}", count + 1);}
Rust Reference