gpt4 book ai didi

rust - 如何使用 Cargo 运行项目示例?

转载 作者:行者123 更新时间:2023-11-29 08:10:00 25 4
gpt4 key购买 nike

我正在尝试运行示例代码 from this project .按照 Cargo 文档上的说明,我执行了以下操作:

git clone https://github.com/basiliscos/rust-procol-ftp-client
cd rust-procol-ftp-client
cargo run
cargo test

cargo test应该也编译好了the example根据 Rust 文档。

虽然 cargo test 执行成功,但是当我进入 target/debug 目录时,我没有找到 ftp-get 的可执行文件>(这是示例代码)。 target/debug/examples 目录也是空的。

运行此示例的最佳方法是什么?

最佳答案

你可以运行一个特定的例子:

cargo run --example name_of_example

其中 name_of_example 是基本文件名(没有 .rs)

或者以 Release模式运行它:

cargo run --release --example name_of_example

将参数传递给示例:

cargo run --example name_of_example -- arguments go here

cargo run 将首先自动构建(或重建)程序,如果它已过时。

关于rust - 如何使用 Cargo 运行项目示例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54469463/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com