aboutsummaryrefslogtreecommitdiff
path: root/rust/clock/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'rust/clock/README.md')
-rw-r--r--rust/clock/README.md102
1 files changed, 102 insertions, 0 deletions
diff --git a/rust/clock/README.md b/rust/clock/README.md
new file mode 100644
index 0000000..8348e33
--- /dev/null
+++ b/rust/clock/README.md
@@ -0,0 +1,102 @@
1# Clock
2
3Implement a clock that handles times without dates.
4
5You should be able to add and subtract minutes to it.
6
7Two clocks that represent the same time should be equal to each other.
8
9## Rust Traits for `.to_string()`
10
11Did you implement `.to_string()` for the `Clock` struct?
12
13If so, try implementing the
14[Display trait](https://doc.rust-lang.org/std/fmt/trait.Display.html) for `Clock` instead.
15
16Traits allow for a common way to implement functionality for various types.
17
18For additional learning, consider how you might implement `String::from` for the `Clock` type.
19You don't have to actually implement this—it's redundant with `Display`, which is generally the
20better choice when the destination type is `String`—but it's useful to have a few type-conversion
21traits in your toolkit.
22
23
24## Rust Installation
25
26Refer to the [exercism help page][help-page] for Rust installation and learning
27resources.
28
29## Writing the Code
30
31Execute the tests with:
32
33```bash
34$ cargo test
35```
36
37All but the first test have been ignored. After you get the first test to
38pass, open the tests source file which is located in the `tests` directory
39and remove the `#[ignore]` flag from the next test and get the tests to pass
40again. Each separate test is a function with `#[test]` flag above it.
41Continue, until you pass every test.
42
43If you wish to run all ignored tests without editing the tests source file, use:
44
45```bash
46$ cargo test -- --ignored
47```
48
49To run a specific test, for example `some_test`, you can use:
50
51```bash
52$ cargo test some_test
53```
54
55If the specific test is ignored use:
56
57```bash
58$ cargo test some_test -- --ignored
59```
60
61To learn more about Rust tests refer to the [online test documentation][rust-tests]
62
63Make sure to read the [Modules][modules] chapter if you
64haven't already, it will help you with organizing your files.
65
66## Further improvements
67
68After 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.
69
70To format your solution, inside the solution directory use
71
72```bash
73cargo fmt
74```
75
76To see, if your solution contains some common ineffective use cases, inside the solution directory use
77
78```bash
79cargo clippy --all-targets
80```
81
82## Submitting the solution
83
84Generally 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.
85
86## Feedback, Issues, Pull Requests
87
88The [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!
89
90If 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).
91
92[help-page]: https://exercism.io/tracks/rust/learning
93[modules]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
94[cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html
95[rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html
96
97## Source
98
99Pairing session with Erin Drummond [https://twitter.com/ebdrummond](https://twitter.com/ebdrummond)
100
101## Submitting Incomplete Solutions
102It's possible to submit an incomplete solution so you can see how others have completed the exercise.