Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use self::Direction::*;
- use std::slice::Iter;
- #[derive(Debug)]
- pub enum Direction { North, South, East, West }
- impl Direction {
- pub fn iterator() -> Iter<'static, Direction> {
- static DIRECTIONS: [Direction; 4] = [North, South, East, West];
- DIRECTIONS.into_iter()
- }
- }
- fn main() {
- for dir in Direction::iterator() {
- println!("{:?}", dir);
- }
- }
Add Comment
Please, Sign In to add comment