How do I provide type annotations inline when calling a non-generic function?

后端 未结 1 434
暖寄归人
暖寄归人 2021-01-18 08:46

One way I know is to provide the type annotations in Rust is by declaring an intermediate variable so the compiler knows the return type:

use std::num::Int
l         


        
1条回答
  •  清歌不尽
    2021-01-18 09:17

    Like so:

    fn main() {
        use std::num::Int;
        println!("Max usize: {}", ::max_value());
    }
    

    0 讨论(0)
提交回复
热议问题