From 178476c520d88932f10ad08fe256b61309989c28 Mon Sep 17 00:00:00 2001 From: Florent Linguenheld Date: Thu, 8 Aug 2024 17:41:11 +0200 Subject: [PATCH] Update book links (#1948) --- exercises/practice/triangle/.docs/instructions.append.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/practice/triangle/.docs/instructions.append.md b/exercises/practice/triangle/.docs/instructions.append.md index d38f8268d..a5eb5f15e 100644 --- a/exercises/practice/triangle/.docs/instructions.append.md +++ b/exercises/practice/triangle/.docs/instructions.append.md @@ -4,8 +4,8 @@ Implementation of this can take many forms. Here are some topics that may help you, depending on the approach you take. -- [Enums](https://doc.rust-lang.org/book/2018-edition/ch06-00-enums.html) -- [Traits](https://doc.rust-lang.org/book/2018-edition/ch10-02-traits.html) +- [Enums](https://doc.rust-lang.org/book/ch06-00-enums.html) +- [Traits](https://doc.rust-lang.org/book/ch10-02-traits.html) - [BTreeSet](https://doc.rust-lang.org/std/collections/btree_set/struct.BTreeSet.html) Or maybe you will come up with an approach that uses none of those! @@ -17,7 +17,7 @@ integers. However, some triangles cannot be represented by pure integers. A simp It would be tedious to rewrite the analysis functions to handle both integer and floating-point cases, and particularly tedious to do so for all potential integer and floating point types: given signed and unsigned variants of bitwidths 8, 16, 32, 64, and 128, that would be 10 reimplementations of fundamentally the same code even before considering floats! -There's a better way: [generics](https://doc.rust-lang.org/stable/book/2018-edition/ch10-00-generics.html). By rewriting your Triangle as a `Triangle`, you can write your code once, and hand off the work of generating all those specializations to the compiler. Note that in order to use mathematical operations, you'll need to constrain your generic type to types which support those operations using traits. +There's a better way: [generics](https://doc.rust-lang.org/stable/book/ch10-00-generics.html). By rewriting your Triangle as a `Triangle`, you can write your code once, and hand off the work of generating all those specializations to the compiler. Note that in order to use mathematical operations, you'll need to constrain your generic type to types which support those operations using traits. There are some bonus tests you can run which test your implementation on floating-point numbers. To enable them, run your tests with the `generic` feature flag, like this: