知识卡片

普通读书笔记卡 · 6074.e.3.a

拥有者也不能绕开借用

理解等级:中级

交出活跃借用后,拥有者自身也必须遵守访问限制:共享借用仍要使用时不能改动对应内容,独占借用仍要使用时也不能从原名另行读取。移动或析构若会使引用失效同样被拒绝。把最后使用放在操作前有时即可结束借用,不必复制对象。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Chapter 3. Concepts Owner Operations · 查看原书依据

      Owner Operations One important consequence of the rules around the existence of references is that they also affect what operations can be performed by the owner of the item. One way to help understand this is to imagine that operations involving the owner are performed by creating and using references under the covers. For example, an attempt to update the

    参考来源

    - 位置:《Effective Rust 35 Specific Ways to Improve Your Rust Code (David Drysdale)》第3章《Owner Operations》(spine7;extracted/Effective Rust 35 Specific Ways to Improve Your Rust Code (David Drysdale)/_epub-src/OEBPS/ch03.html;u091-ch03-015)。 - 结论依据:原文在“Owner Operations”附近的定义、例子或代码支撑本卡核心说明:交出活跃借用后,拥有者自身也必须遵守访问限制:共享借用仍要使用时不能改动对应内容,独占借用仍要使用时也不能从原名另行读取。边界按已读前提解释;示例未执行。 - 原始内容:Owner Operations One important consequence of the rules around the existence of references is that they also affect what operations can be performed by the owner of the item. One way to help understand this is to imagine that operations involving the owner are performed by creating and using references under the covers. For example, an attempt to update the