ch6.1: Fix bad example
MuhammadAbdullahWarraich opened this issue · comments
- I have searched open and closed issues and pull requests for duplicates, using these search terms:
- example
- chapter
- I have checked the latest
main
branch to see if this has already been fixed, in this file:
URL to the section(s) of the book with this problem:
https://doc.rust-lang.org/stable/book/ch06-01-defining-an-enum.html
Description of the problem:
" For example, we may want to say that Rectangle is one of a set of possible shapes that also includes Circle and Triangle. To do this, Rust allows us to encode these possibilities as an enum. "
Suggested fix:
" For example, we may want to say that Shape is one of a set of possible shapes that also includes Rectangle, Circle and Triangle. To do this, Rust allows us to encode these possibilities as an enum. "
try slices rust .it's posible and fast. 🙂
you encode in a struct.
struct triangle, struct cube, struct circle.
and can ad an integer element who refers this enum.
and these is vintage conventional way.
see slices in rust tambien.
I prefer this as-is. Thanks though!