我正在从 Rust 教程中构建示例。当我尝试编译这个示例时:
use std::float;
use std::num::atan;
fn angle(vector: (float, float)) -> float {
let pi = float::consts::pi;
match vector {
(0f, y) if y < 0f => 1.5 * pi,
(0f, y) => 0.5 * pi,
(x, y) => atan(y / x)
}
}
我遇到了这个错误。我使用 rust build Test.rs
进行编译。为什么编译器找不到 std::num::atan
?