1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-26 09:12:58 +02:00

Update structs.md (#1403)

Fix markdown
This commit is contained in:
justanotheranonymoususer 2023-10-22 17:24:04 +03:00 committed by GitHub
parent c3abb35837
commit 1dfb82c085
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,7 +35,7 @@ Key Points:
* Unlike in C++, there is no inheritance between structs. * Unlike in C++, there is no inheritance between structs.
* Methods are defined in an `impl` block, which we will see in following slides. * Methods are defined in an `impl` block, which we will see in following slides.
* This may be a good time to let people know there are different types of structs. * This may be a good time to let people know there are different types of structs.
* Zero-sized structs `e.g., struct Foo;` might be used when implementing a trait on some type but don’t have any data that you want to store in the value itself. * Zero-sized structs (e.g. `struct Foo;`) might be used when implementing a trait on some type but don’t have any data that you want to store in the value itself.
* The next slide will introduce Tuple structs, used when the field names are not important. * The next slide will introduce Tuple structs, used when the field names are not important.
* The syntax `..peter` allows us to copy the majority of the fields from the old struct without having to explicitly type it all out. It must always be the last element. * The syntax `..peter` allows us to copy the majority of the fields from the old struct without having to explicitly type it all out. It must always be the last element.