Hello,
I have been reading through the second edition of the book online and was confused by the following sentence in Chapter 8, section 2 ("Strings):
Similar to the String/Str naming, they often provide an owned and borrowed variant, just like String/&str.
What does it mean to have an asterisk in front of a type name? From what I understand, the asterisk is used to deference a borrowed reference, so I couldn't understand its meaning when in front of a type name.
I also did not understand the use of "Str" in the phrase "String/Str." What is Str in this context? From what I can recall, this is the only location where "Str" has appeared thus far.
I apologize if my question(s) were answered elsewhere in the book and/or I have overlooked something that was already explained!
Thank you very much for writing such a great book and making it available publicly for free! I am eagerly awaiting the print edition to arrive. :)
So, the * was intended to mean "any". so like `OsString and CString are both *Strings, the \* covers their differences. That's also the *Str bit, OsStr and CStr.
However, uh, with pointers, I can see how this is confusing. I actually thought it was a rendering bug at first.
Yup, I agree this is confusing. I think the change will be small enough that we can get a fix in before print-- @steveklabnik do you have a rewording in mind?
how about
See how those names all end in
StringorStr? They refer to owned and borrowed variants, just like theStringandstrtypes you've seen previously.
Thank you very much for the clarification and sorry for the delay in responding!
The proposed rewording sounds good. 馃憤
Most helpful comment
how about