如何使 Rust 草书的示例在 Windows 上工作?

How to make Rust cursive's examples work on Windows?

Rust cursive is a Rust TUI framework. It states that you can switch backends and some of which are Windows supported. However, I can't make it work. When I run the following command (grabbed from here) 我得到一个错误:

$ git clone https://github.com/gyscos/cursive
$ cd cursive/examples

$ cargo run -v --no-default-features --features pancurses-backend --example select
error: Package `cursive-examples v0.1.1-alpha.0 (C:\my_projects\cursive\examples)`
does not have the feature `pancurses-backend`

运行 Windows 上的这些示例的正确方法是什么?

如错误所述,cursiveexamples package does not have a pancurses-backend feature, which if you look in examples/Cargo.toml is correct. The pancurses-backend feature is actually located in the Cargo.toml

所以要启用它,您必须改为 --features cursive/pancurses-backend

虽然该目录 有点误导性 称为 examples。在这种情况下,您不能使用 --example,因为它们不是 Cargo 意义上的示例。相反,您需要使用 --bin.

cargo run -v --no-default-features --features cursive/pancurses-backend --bin select

设置

[dependencies.cursive] 
version = "0.16.3"
default-features = false
features = ["crossterm-backend"]

在 Cargo.toml 也为我工作 Windows

然后开火

cargo run