Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Hey I was wondering why you used PhantomData here, I don't fully understand what the motivation is. Do you mind explaining why you decided to use it?
It may also be worth adding that this is a good test for unsigned integers, but will not work in general for signed integers when using rust. Since
len()
always returns a positive number (usize
) this is a safe test in the above code.If you're trying to test odd/even for something that could be positive or negative, the
n % 2 == 0
test is a better choice.