1

This code compile and run without problem

struct A(i32);

fn ooo<T>(_t: T) {}

fn main() {
    ooo(A);
}

I don't understand

  • the meaning of ooo(A)
  • the type of _t
Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
  • `A` is a function that accepts an `i32` and returns an `A`. All functions are their own type, but that type can become a function pointer or implement the `Fn*` traits. – Shepmaster Nov 16 '20 at 16:13
  • See also [How do I print the type of a variable in Rust?](https://stackoverflow.com/q/21747136/155423): `let _: () = A;` => *found fn item `fn(i32) -> A {A}`* – Shepmaster Nov 16 '20 at 16:16

0 Answers0