From 267eda40ebd2c5302f204f4c69e04d4aa4a36d3b Mon Sep 17 00:00:00 2001 From: Peter Tseng Date: Tue, 9 May 2017 00:51:21 -0700 Subject: [PATCH] copy description.md and metadata.yml to .meta directory If, as proposed in https://github.com/exercism/trackler/issues/45, the proper location of these files moves to the .meta directory, this allows Trackler to freely change its expectations without having to wait for this track to move and/or support multiple locations at once. If the proposal is accepted and implemented, the original files may be removed. Of course, until then, the original files must remain, since Trackler still expects them at the original location. --- exercises/luhn-from/.meta/description.md | 9 +++++++++ exercises/luhn-from/.meta/metadata.yml | 3 +++ exercises/luhn-trait/.meta/description.md | 17 +++++++++++++++++ exercises/luhn-trait/.meta/metadata.yml | 3 +++ 4 files changed, 32 insertions(+) create mode 100644 exercises/luhn-from/.meta/description.md create mode 100644 exercises/luhn-from/.meta/metadata.yml create mode 100644 exercises/luhn-trait/.meta/description.md create mode 100644 exercises/luhn-trait/.meta/metadata.yml diff --git a/exercises/luhn-from/.meta/description.md b/exercises/luhn-from/.meta/description.md new file mode 100644 index 000000000..1bf1850e5 --- /dev/null +++ b/exercises/luhn-from/.meta/description.md @@ -0,0 +1,9 @@ +# Luhn: Using the From Trait + +Before doing this exercise you should probably do the original Luhn exercise. If you have not completed Luhn, you can get it by running the command: + +> `exercism fetch rust luhn` + +In the original Luhn exercise you only validated strings, but the Luhn algorithm can be applied to integers as well. + +In this exercise you'll implement the [From trait](https://doc.rust-lang.org/std/convert/trait.From.html) to convert strings, strs and unsigned integers into a Struct that performs the validation. diff --git a/exercises/luhn-from/.meta/metadata.yml b/exercises/luhn-from/.meta/metadata.yml new file mode 100644 index 000000000..bc1e12911 --- /dev/null +++ b/exercises/luhn-from/.meta/metadata.yml @@ -0,0 +1,3 @@ +--- +blurb: "Luhn: Using the From Trait" +source: "The Rust track maintainers, based on the original Luhn exercise" diff --git a/exercises/luhn-trait/.meta/description.md b/exercises/luhn-trait/.meta/description.md new file mode 100644 index 000000000..fd9ce2b3c --- /dev/null +++ b/exercises/luhn-trait/.meta/description.md @@ -0,0 +1,17 @@ +# Luhn: Using a Custom Trait + +Before doing this exercise you should probably do the original Luhn exercise and its successor, "Luhn: Using the From Trait" + +To get the original Luhn exercise, run `exercism fetch rust luhn` + +To get the "Luhn: Using the From Trait" exercise, run `exercism fetch rust luhn-from` + +In the original Luhn exercise you only validated strings, but the Luhn algorithm can be applied to integers as well. + +In "Luhn: Using the From Trait" you implemented a From trait, which also required you to create a Luhn struct. + +Instead of creating a Struct just to perform the validation, what if you you validated the primitives (i.e, String, u8, etc.) themselves? + +In this exercise you'll create and implement a custom [trait](https://doc.rust-lang.org/book/traits.html) that performs the validation. + +Note: It is [not idiomatic Rust to implement traits on on primitives](https://doc.rust-lang.org/book/traits.html#rules-for-implementing-traits). In this exercise we're showing something that you _can_ do, not something you _should_ do. If you find yourself implementing traits on primitives, perhaps you have a case of [Primitive Obsession](http://wiki.c2.com/?PrimitiveObsession). diff --git a/exercises/luhn-trait/.meta/metadata.yml b/exercises/luhn-trait/.meta/metadata.yml new file mode 100644 index 000000000..dfa0c3b26 --- /dev/null +++ b/exercises/luhn-trait/.meta/metadata.yml @@ -0,0 +1,3 @@ +--- +blurb: "Luhn: Using a Custom Trait" +source: "The Rust track maintainters, based on the original Luhn exercise"