https://github.com/urschrei/rust_fizzbuzz
Implementing FizzBuzz using Rust 1.0
https://github.com/urschrei/rust_fizzbuzz
fizzbuzz rust
Last synced: 2 days ago
JSON representation
Implementing FizzBuzz using Rust 1.0
- Host: GitHub
- URL: https://github.com/urschrei/rust_fizzbuzz
- Owner: urschrei
- Created: 2015-05-18T16:34:34.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2018-10-21T15:45:06.000Z (over 7 years ago)
- Last Synced: 2025-11-07T02:03:44.698Z (8 months ago)
- Topics: fizzbuzz, rust
- Language: Rust
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WHAT (May 18th, 2015)
An update of Lindsey Kuper's excellent [Rust FizzBuzz](http://composition.al/blog/2013/03/02/fizzbuzz-revisited/) using Rust 1.x, as a way of taking some tentative first steps towards learning the language.
The [`by_reference`](https://github.com/urschrei/rust_fizzbuzz/tree/by_reference) branch contains a variant which passes the results of the division operations to `int_to_rem` by reference, where they're destructured. Note that this isn't necessarily more efficient or flexible, however, since `i32` is a primitive type, and thus implements the `Copy` trait.
This approach to solving `FizzBuzz` using Rust is by no means the fastest way to do it (see [Chris Morgan's explorations](http://chrismorgan.info/blog/rust-fizzbuzz.html) for more), but I find this implementation particularly intuitive, and well-suited to the language.