docs: clarify mutability wording in User struct example#1605
Open
skylunna wants to merge 1 commit intosunface:mainfrom
Open
docs: clarify mutability wording in User struct example#1605skylunna wants to merge 1 commit intosunface:mainfrom
skylunna wants to merge 1 commit intosunface:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这个PR是做什么的?
修复了在第二部分:Rust基础入门-复合类型-结构体中,String可变性的一个可能令人困惑的语句。
为什么这么做
原始文本说“例如 username 代表了用户名,是一个可变的 String 类型”。
虽然
String支持内容修改,但struct字段本身并不是可变的,在实例上没有使用“mut”。为了不让初学者产生奇怪的困惑,所以修改了其表述。修改
username代表了用户名,其类型是 String(一种支持内容修改的字符串类型)。