知识卡片
字段与下标表示存储位置
game.black_pawns、coords.1 和 pieces[i] 分别选中结构体字段、元组字段和元素。它们可用于读取,也是具备写权限时可出现在赋值左边的位置。访问引用或智能指针上的这些成员时,点号和下标可以自动解引用。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Expressions 访问可写位置与用区间借用切片 · 查看原书依据
Expressions like these three are called lvalues, because they can appear on the left side of an assignment:
参考来源
- 位置:《Programming Rust Fast, Safe Systems Development, 3rd ed. (First Early Release)》第05章《Expressions》|访问可写位置与用区间借用切片,来源项目 `book-source`,`extracted/Programming Rust Fast, Safe Systems Development, 3rd ed. (First Early Release)/_epub-src/OEBPS/ch05.xhtml#fields-and-elements`
- 结论依据:原文逐项演示字段与下标读取,再展示同样的表达式作为赋值目标。
- 原始内容:Expressions like these three are called lvalues, because they can appear on the left side of an assignment: