知识卡片

普通读书笔记卡 · 6076.a.3

依赖范围兼顾下限与升级空间

理解等级:高级

库依赖通常声明兼容范围及确实需要的最低版本:太窄的精确钉版易与其他使用者冲突,太宽的*又容许完全不同接口。需要重复构建时用锁文件,而非把所有范围都改成单版。特殊兼容问题可有例外,但应说明原因和解除条件。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Chapter 4. Dependencies Version Specification · 查看原书依据

      Goldilocks specification—not too precise, not too vague—is to allow semver-compatible versions ("1") of a crate, possibly with a specific minimum version that includes a feature or fix that you require ("1.4.23"). Both of these version specifications make use of Cargo’s default behavior, which is to allow versions that are semver-compatible with the specifie

    参考来源

    - 位置:《Effective Rust 35 Specific Ways to Improve Your Rust Code (David Drysdale)》第4章《Version Specification》(spine8;extracted/Effective Rust 35 Specific Ways to Improve Your Rust Code (David Drysdale)/_epub-src/OEBPS/ch04.html;u125-ch04-016)。 - 结论依据:原文在“Goldilocks specification”附近的定义、例子或代码支撑本卡核心说明:库依赖通常声明兼容范围及确实需要的最低版本:太窄的精确钉版易与其他使用者冲突,太宽的*又容许完全不同接口。边界按已读前提解释;示例未执行。 - 原始内容:Goldilocks specification—not too precise, not too vague—is to allow semver-compatible versions ("1") of a crate, possibly with a specific minimum version that includes a feature or fix that you require ("1.4.23"). Both of these version specifications make use of Cargo’s default behavior, which is to allow versions that are semver-compatible with the specifie