aboutsummaryrefslogtreecommitdiff
path: root/rust/reverse-string/README.md
diff options
context:
space:
mode:
authorFederico Igne <git@federicoigne.com>2020-12-26 17:48:38 +0000
committerFederico Igne <git@federicoigne.com>2021-11-03 18:55:08 +0000
commit02481656966b0a8dfc95cf3c22bcc049660ff7d4 (patch)
tree8e39798fcaf27931d91c2088423fd4e97adcfc2d /rust/reverse-string/README.md
parent4e2052c4d792540c2f742b2c2a081b11117ed41d (diff)
downloadexercism-02481656966b0a8dfc95cf3c22bcc049660ff7d4.tar.gz
exercism-02481656966b0a8dfc95cf3c22bcc049660ff7d4.zip
Move Rust exercises in a subdirectory
Diffstat (limited to 'rust/reverse-string/README.md')
-rw-r--r--rust/reverse-string/README.md103
1 files changed, 103 insertions, 0 deletions
diff --git a/rust/reverse-string/README.md b/rust/reverse-string/README.md
new file mode 100644
index 0000000..78e9753
--- /dev/null
+++ b/rust/reverse-string/README.md
@@ -0,0 +1,103 @@
1# Reverse String
2
3Reverse a string
4
5For example:
6input: "cool"
7output: "looc"
8
9## Bonus
10Test your function on this string: `uüu` and see what happens. Try to write a function that properly
11reverses this string. Hint: grapheme clusters
12
13To get the bonus test to run, remove the ignore flag (`#[ignore]`) from the
14last test, and execute the tests with:
15
16```bash
17$ cargo test --features grapheme
18```
19
20You will need to use external libraries (a `crate` in rust lingo) for the bonus task. A good place to look for those is [crates.io](https://crates.io/), the official repository of crates.
21
22[Check the documentation](https://doc.rust-lang.org/cargo/guide/dependencies.html) for instructions on how to use external crates in your projects.
23
24
25## Rust Installation
26
27Refer to the [exercism help page][help-page] for Rust installation and learning
28resources.
29
30## Writing the Code
31
32Execute the tests with:
33
34```bash
35$ cargo test
36```
37
38All but the first test have been ignored. After you get the first test to
39pass, open the tests source file which is located in the `tests` directory
40and remove the `#[ignore]` flag from the next test and get the tests to pass
41again. Each separate test is a function with `#[test]` flag above it.
42Continue, until you pass every test.
43
44If you wish to run all ignored tests without editing the tests source file, use:
45
46```bash
47$ cargo test -- --ignored
48```
49
50To run a specific test, for example `some_test`, you can use:
51
52```bash
53$ cargo test some_test
54```
55
56If the specific test is ignored use:
57
58```bash
59$ cargo test some_test -- --ignored
60```
61
62To learn more about Rust tests refer to the [online test documentation][rust-tests]
63
64Make sure to read the [Modules][modules] chapter if you
65haven't already, it will help you with organizing your files.
66
67## Further improvements
68
69After you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution.
70
71To format your solution, inside the solution directory use
72
73```bash
74cargo fmt
75```
76
77To see, if your solution contains some common ineffective use cases, inside the solution directory use
78
79```bash
80cargo clippy --all-targets
81```
82
83## Submitting the solution
84
85Generally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer.
86
87## Feedback, Issues, Pull Requests
88
89The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
90
91If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
92
93[help-page]: https://exercism.io/tracks/rust/learning
94[modules]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
95[cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html
96[rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html
97
98## Source
99
100Introductory challenge to reverse an input string [https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb](https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb)
101
102## Submitting Incomplete Solutions
103It's possible to submit an incomplete solution so you can see how others have completed the exercise.