我会使用ncurses,但希望它在Windows上运行。在C ++中,我可以使用conio kbhit()和getch()从conio来首先检查是否按下了字符,然后再获取它。
我想要在Rust中也有类似的东西。
我有这样的结构
struct Point {
pub x: i32,
pub y: i32,
}
impl Point {
fn new(x: i32, y: i32) -> Self {
Point { x, y }
}
}
Run Code Online (Sandbox Code Playgroud)
还有像这样的数组
[Point::new(1, 1), Point::new(4, 2), Point::new(2, 9)];
Run Code Online (Sandbox Code Playgroud)
如何point.x从此阵列中拉出最大的项目?
rust ×2