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

后端 未结 1 432
暖寄归人
暖寄归人 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: {}", <usize as Int>::max_value());
    }
    
    0 讨论(0)
提交回复
热议问题