1
0
Fork 0
mirror of https://github.com/notohh/rustlings.git synced 2025-08-20 00:43:36 -04:00

chore: Removed extra whitespaces

Co-authored-by: Corentin ARNOULD <corentin.arn@gmail.com>
This commit is contained in:
Koalab99 2020-08-27 19:51:19 +02:00 committed by GitHub
commit ee7cdc66b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 25 deletions
exercises
enums
error_handling
generics
traits

View file

@ -1,8 +1,8 @@
### Enums
Rust allows you to define types called "enums" which enumerate possible values.
Rust allows you to define types called "enums" which enumerate possible values.
Enums are a feature in many languages, but their capabilities differ in each language. Rusts enums are most similar to algebraic data types in functional languages, such as F#, OCaml, and Haskell.
Useful in combination with enums is Rust's "pattern matching" facility, which makes it easy to run different code for different values of an enumeration.
Useful in combination with enums is Rust's "pattern matching" facility, which makes it easy to run different code for different values of an enumeration.
#### Book Sections

View file

@ -1,5 +1,5 @@
For this exercise check out the sections:
- [Error Handling](https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html)
- [Generics](https://doc.rust-lang.org/book/ch10-01-syntax.html)
- [Error Handling](https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html)
- [Generics](https://doc.rust-lang.org/book/ch10-01-syntax.html)
of the Rust Book.

View file

@ -4,8 +4,8 @@
// However, the school also issues alphabetical grades (A+ -> F-) and needs
// to be able to print both types of report card!
// Make the necessary code changes in the struct ReportCard and the impl block
// to support alphabetical report cards. Change the Grade in the second test to "A+"
// Make the necessary code changes in the struct ReportCard and the impl block
// to support alphabetical report cards. Change the Grade in the second test to "A+"
// to show that your changes allow alphabetical grades.
// Execute 'rustlings hint generics3' for hints!

View file

@ -1,6 +1,6 @@
### Traits
A trait is a collection of methods.
A trait is a collection of methods.
Data types can implement traits. To do so, the methods making up the trait are defined for the data type. For example, the `String` data type implements the `From<&str>` trait. This allows a user to write `String::from("hello")`.
@ -8,7 +8,7 @@ In this way, traits are somewhat similar to Java interfaces and C++ abstract cla
Some additional common Rust traits include:
+ `Clone` (the `clone` method),
+ `Clone` (the `clone` method),
+ `Display` (which allows formatted display via `{}`), and
+ `Debug` (which allows formatted display via `{:?}`).
@ -17,4 +17,4 @@ Because traits indicate shared behavior between data types, they are useful when
#### Book Sections
- [Traits](https://doc.rust-lang.org/book/ch10-02-traits.html)
- [Traits](https://doc.rust-lang.org/book/ch10-02-traits.html)