Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention that format! does not take ownership? #291

Closed
carols10cents opened this issue Oct 7, 2016 · 1 comment
Closed

Mention that format! does not take ownership? #291

carols10cents opened this issue Oct 7, 2016 · 1 comment
Assignees
Labels
Milestone

Comments

@carols10cents
Copy link
Member

In feedback from fbstj:

in the first example of concatenation there was an aside about String + &str taking ownership of
the first part (which might be an extra point against doing the multiple + given potential
precedence oddities) but there's nothing about how format! takes & (I went and looked it up in
the docs/code

basically it's because ownership is brought up during the previous example but not during this it
just felt a little strange.

This feedback is about this paragraph in ch08-02-strings.md:

This code will also set s to "tic-tac-toe". The format! macro works in the same way as println!,
but instead of printing the output to the screen, it returns a String with the contents. This
version is much easier to read than all of the +s.

@carols10cents carols10cents added this to the ch8 milestone Oct 7, 2016
@carols10cents carols10cents self-assigned this Oct 7, 2016
@fbstj
Copy link
Contributor

fbstj commented Oct 10, 2016

OK you mentioned that the book has previously discussed println!. I haven't actually read all the book recently, so reading through this chapter on it's own, this definitely jumped out at me as a question. It might be that readers of the actual book will not hit this since they'll have probably read the previous chapters...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants