知识卡片
示例程序提供外部使用路径
examples目录可保存使用库的独立程序,帮助用户理解完整调用流程;tests中的集成测试也能展示外部接口。示例主要解释如何用,测试主要验证预期,不能因测试存在就省掉必要的使用说明。让两者贴近公共接口,有助发现只有内部调用才成立的设计。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Chapter 5. Tooling Additional Documentation Locations · 查看原书依据
examples/ subdirectory of a Cargo project can hold the code for standalone binaries that make use of your crate. These programs are built and run very similarly to integration tests (Item 30) but are specifically intended to hold example code that illustrates the correct use of your crate’s interface. On a related note, bear in mind that the integration test
参考来源
- 位置:《Effective Rust 35 Specific Ways to Improve Your Rust Code (David Drysdale)》第5章《Additional Documentation Locations》(spine9;extracted/Effective Rust 35 Specific Ways to Improve Your Rust Code (David Drysdale)/_epub-src/OEBPS/ch05.html;u136-ch05-003)。
- 结论依据:原文在“examples/”附近的定义、例子或代码支撑本卡核心说明:examples目录可保存使用库的独立程序,帮助用户理解完整调用流程;tests中的集成测试也能展示外部接口。边界按已读前提解释;示例未执行。
- 原始内容:examples/ subdirectory of a Cargo project can hold the code for standalone binaries that make use of your crate. These programs are built and run very similarly to integration tests (Item 30) but are specifically intended to hold example code that illustrates the correct use of your crate’s interface. On a related note, bear in mind that the integration test