知识卡片
基础库提供无需堆的能力
core提供Option、Result、迭代器等不依赖堆分配的基础能力,std中许多同名项只是重导出同一类型。no_std仍有core的prelude,只是缺少std特有自动导入。查看来源有助定位,但具体项是否稳定且受目标支持,还需核对所用版本。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Chapter 6. Beyond Standard Rust core · 查看原书依据
core library, a standard library that’s available even in the most no_std of environments. These core:: types behave exactly the same as the equivalent std:: types, because they’re actually the same types—in each case, the std:: version is just a re-export of the underlying core:: type. This means that there’s a quick and dirty way to tell if a std:: item is
参考来源
- 位置:《Effective Rust 35 Specific Ways to Improve Your Rust Code (David Drysdale)》第6章《core》(spine10;extracted/Effective Rust 35 Specific Ways to Improve Your Rust Code (David Drysdale)/_epub-src/OEBPS/ch06.html;u168-ch06-002)。
- 结论依据:原文在“core library”附近的定义、例子或代码支撑本卡核心说明:core提供Option、Result、迭代器等不依赖堆分配的基础能力,std中许多同名项只是重导出同一类型。边界按已读前提解释;示例未执行。
- 原始内容:core library, a standard library that’s available even in the most no_std of environments. These core:: types behave exactly the same as the equivalent std:: types, because they’re actually the same types—in each case, the std:: version is just a re-export of the underlying core:: type. This means that there’s a quick and dirty way to tell if a std:: item is