In Rust, what is `fn() -> ()`?

后端 未结 3 1953
灰色年华
灰色年华 2021-01-19 22:04

I have a grasp of the Fn (capital-F) traits: Fn, FnMut, FnOnce. I understand that they are traits and work like traits.

But wha

3条回答
  •  情歌与酒
    2021-01-19 22:45

    fn is the type for a function pointer. See also here in the documentation: https://doc.rust-lang.org/std/primitive.fn.html

提交回复
热议问题