summaryrefslogtreecommitdiff
path: root/exercises/conversions/try_from_into.rs
diff options
context:
space:
mode:
Diffstat (limited to 'exercises/conversions/try_from_into.rs')
-rw-r--r--exercises/conversions/try_from_into.rs27
1 files changed, 15 insertions, 12 deletions
diff --git a/exercises/conversions/try_from_into.rs b/exercises/conversions/try_from_into.rs
index fa98bc9..32d6ef3 100644
--- a/exercises/conversions/try_from_into.rs
+++ b/exercises/conversions/try_from_into.rs
@@ -1,9 +1,13 @@
// try_from_into.rs
-// TryFrom is a simple and safe type conversion that may fail in a controlled way under some circumstances.
-// Basically, this is the same as From. The main difference is that this should return a Result type
-// instead of the target type itself.
-// You can read more about it at https://doc.rust-lang.org/std/convert/trait.TryFrom.html
-// Execute `rustlings hint try_from_into` or use the `hint` watch subcommand for a hint.
+//
+// TryFrom is a simple and safe type conversion that may fail in a controlled
+// way under some circumstances. Basically, this is the same as From. The main
+// difference is that this should return a Result type instead of the target
+// type itself. You can read more about it at
+// https://doc.rust-lang.org/std/convert/trait.TryFrom.html
+//
+// Execute `rustlings hint try_from_into` or use the `hint` watch subcommand for
+// a hint.
use std::convert::{TryFrom, TryInto};
@@ -25,14 +29,13 @@ enum IntoColorError {
// I AM NOT DONE
-// Your task is to complete this implementation
-// and return an Ok result of inner type Color.
-// You need to create an implementation for a tuple of three integers,
-// an array of three integers, and a slice of integers.
+// Your task is to complete this implementation and return an Ok result of inner
+// type Color. You need to create an implementation for a tuple of three
+// integers, an array of three integers, and a slice of integers.
//
-// Note that the implementation for tuple and array will be checked at compile time,
-// but the slice implementation needs to check the slice length!
-// Also note that correct RGB color values must be integers in the 0..=255 range.
+// Note that the implementation for tuple and array will be checked at compile
+// time, but the slice implementation needs to check the slice length! Also note
+// that correct RGB color values must be integers in the 0..=255 range.
// Tuple implementation
impl TryFrom<(i16, i16, i16)> for Color {