diff options
Diffstat (limited to 'rust/space-age/README.md')
| -rw-r--r-- | rust/space-age/README.md | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/rust/space-age/README.md b/rust/space-age/README.md new file mode 100644 index 0000000..9724784 --- /dev/null +++ b/rust/space-age/README.md | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | # Space Age | ||
| 2 | |||
| 3 | Welcome to Space Age on Exercism's Rust Track. | ||
| 4 | If you need help running the tests or submitting your code, check out `HELP.md`. | ||
| 5 | |||
| 6 | ## Instructions | ||
| 7 | |||
| 8 | Given an age in seconds, calculate how old someone would be on: | ||
| 9 | |||
| 10 | - Mercury: orbital period 0.2408467 Earth years | ||
| 11 | - Venus: orbital period 0.61519726 Earth years | ||
| 12 | - Earth: orbital period 1.0 Earth years, 365.25 Earth days, or 31557600 seconds | ||
| 13 | - Mars: orbital period 1.8808158 Earth years | ||
| 14 | - Jupiter: orbital period 11.862615 Earth years | ||
| 15 | - Saturn: orbital period 29.447498 Earth years | ||
| 16 | - Uranus: orbital period 84.016846 Earth years | ||
| 17 | - Neptune: orbital period 164.79132 Earth years | ||
| 18 | |||
| 19 | So if you were told someone were 1,000,000,000 seconds old, you should | ||
| 20 | be able to say that they're 31.69 Earth-years old. | ||
| 21 | |||
| 22 | If you're wondering why Pluto didn't make the cut, go watch [this | ||
| 23 | youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs). | ||
| 24 | |||
| 25 | Some Rust topics you may want to read about while solving this problem: | ||
| 26 | |||
| 27 | - Traits, both the From trait and implementing your own traits | ||
| 28 | - Default method implementations for traits | ||
| 29 | - Macros, the use of a macro could reduce boilerplate and increase readability | ||
| 30 | for this exercise. For instance, | ||
| 31 | [a macro can implement a trait for multiple types at once](https://stackoverflow.com/questions/39150216/implementing-a-trait-for-multiple-types-at-once), | ||
| 32 | though it is fine to implement `years_during` in the Planet trait itself. A macro could | ||
| 33 | define both the structs and their implementations. Info to get started with macros can | ||
| 34 | be found at: | ||
| 35 | |||
| 36 | - [The Macros chapter in The Rust Programming Language](https://doc.rust-lang.org/stable/book/ch19-06-macros.html) | ||
| 37 | - [an older version of the Macros chapter with helpful detail](https://doc.rust-lang.org/1.30.0/book/first-edition/macros.html) | ||
| 38 | - [Rust By Example](https://doc.rust-lang.org/stable/rust-by-example/macros.html) | ||
| 39 | |||
| 40 | ## Source | ||
| 41 | |||
| 42 | ### Created by | ||
| 43 | |||
| 44 | - @IanWhitney | ||
| 45 | |||
| 46 | ### Contributed to by | ||
| 47 | |||
| 48 | - @ashleygwilliams | ||
| 49 | - @bobahop | ||
| 50 | - @coriolinus | ||
| 51 | - @cwhakes | ||
| 52 | - @durka | ||
| 53 | - @eddyp | ||
| 54 | - @efx | ||
| 55 | - @ErikSchierboom | ||
| 56 | - @IanWhitney | ||
| 57 | - @joshgoebel | ||
| 58 | - @lutostag | ||
| 59 | - @nfiles | ||
| 60 | - @ocstl | ||
| 61 | - @petertseng | ||
| 62 | - @rofrol | ||
| 63 | - @stringparser | ||
| 64 | - @xakon | ||
| 65 | - @ZapAnton | ||
| 66 | |||
| 67 | ### Based on | ||
| 68 | |||
| 69 | Partially inspired by Chapter 1 in Chris Pine's online Learn to Program tutorial. - http://pine.fm/LearnToProgram/?Chapter=01 \ No newline at end of file | ||
