You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the problem:
I would assume the comment should be of type String struct instead of Tuple struct. Please clarify if I’m mistaken in my assumption.
The text was updated successfully, but these errors were encountered:
m3et
changed the title
Wrong struct type in example
Wrong struct type in example comment
Mar 10, 2025
Thanks for reporting. I think you are wrong. Regular structs have named fields like in C. Rust's tuple structs have fields with no names, accessed by constant index like my_struct.0 (first component). As your provided line of code defines a struct with just a data component (of type String) with no associated name, it is a tuple struct.
main
branch to see if this has already been fixed, in this file:URL to the section(s) of the book with this problem:
book/listings/ch06-enums-and-pattern-matching/no-listing-04-structs-similar-to-message-enum/src/main.rs
Line 7 in 81a976a
Description of the problem:
I would assume the comment should be of type String struct instead of Tuple struct. Please clarify if I’m mistaken in my assumption.
The text was updated successfully, but these errors were encountered: