turbofish
Appearance
English
[edit]Etymology
[edit]From turbo- + fish; coined by Anna Harren in 2015,[1][2][3] originally in jest, later adopted by official documentation.
Pronunciation
[edit]- (General American) IPA(key): /ˈtɝboʊˌfɪʃ/
Noun
[edit]turbofish (plural turbofishes)
- (programming) A syntactic element in Rust,
::<>
, with arguments between<
and>
, that specifies the generic arguments of a function in an expression.- 2017 November 21, Jim Blandy, Jason Orendorff, Programming Rust: Fast, Safe Systems Development, "O'Reilly Media, Inc.", →ISBN:
- For static method calls, you can supply the type parameter explicitly using the turbofish ::<> notation:
- 2019 January 31, Rahul Sharma, Vesa Kaihlavirta, Mastering Rust, Packt Publishing Ltd, →ISBN, page 122:
- The turbofish operator in generic functions appears right after the function name and before the parenthesis.
- 2021 June 30, Herbert Wolverson, Hands-on Rust, Pragmatic Bookshelf, →ISBN:
- You can add a turbofish to a function call with the syntax function::<Type>(). For example, collect::<Vec<MyType>>().
References
[edit]Further reading
[edit]- “Paths in expressions”, in The Rust Reference[1], 2019