Rust take-home assignment
Definitions
A "palindrome" is a number that is the same when the digits are reversed. For example, 121, 2332, and 6 are all palindromes. But 10 is not a palindrome (since leading zeroes are not allowed). Treat 0 as a palindrome, and use an unsigned integer type.
Goal
Write crate that allows the user to:
- check if a number is a palindrome
- generate the first N palindromes
Assumptions
- No need to deal with numbers greater than 1,000,000.
- Code may panic if it is called with any values that would result in a number greater than 1,000,000 being generated.
- 3rd-party crates can be used, but they may not appear in your public API.
Constrains
If a crate literally implements the question as-is, don't use it.
Abstract
The main focus of the exercise is to develop a high-quality crate. The exact meaning of "high-quality" is left deliberately vague, but use your best judgement. Think about the crates you've had the best experience with, and try to emulate those. The exact details of the API are up to you - there are no hard requirements about function signatures, etc (other than there being no 3rd-party types present in the API).
Code location
There are two ways to use the palindrome library:
- The code can be cloned from the github.com:
> git clone https://github.com/binspammer/palindrome.git
and and the crate can be taked from bs_crate directly.
- Or it can be just used directly from crates.io:
Using
The crate should be used like this:
use bs_crate;