← 返回起始笔记位置

知识卡片

普通读书笔记卡 · 6991.r.4.u.1.c.1 · 生成模型:未记录

Cargo包的运行入口

理解等级:初级

cargo new hello 为二进制包建出 Cargo.toml 和 src/main.rs。清单记录包名、版本、edition 与依赖,main 是应用开始执行的位置。进入包目录后用 cargo run 构建并运行,cargo clean 可删去构建产物。这样构建约定与应用代码各有明确入口。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Programming Rust Fast, Safe Systems Development, 3rd ed. (First Early Release)》第01章《A Tour of Rust》|从工具链到可运行的软件包,来源项目 `book-source`,`extracted/Programming Rust Fast, Safe Systems Development, 3rd ed. (First Early Release)/_epub-src/OEBPS/ch01.xhtml#rustup-and-cargo` - 结论依据:生成 hello 的示例展示了项目清单、源码入口、执行和清理。 - 原始内容:This command creates a new package directory named hello, ready to build a command-line executable.