我无法编译将类型从整数转换为字符串的代码.我正在运行Rust for Rubyists tutorial中的一个示例,它有各种类型转换,例如:
"Fizz".to_str()
和num.to_str()
(其中num
是整数).
我认为这to_str()
个函数调用中的大多数(如果不是全部的话)都被弃用了.当前将整数转换为字符串的方法是什么?
我得到的错误是:
error: type `&'static str` does not implement any method in scope named `to_str`
error: type `int` does not implement any method in scope named `to_str`