Skip to content

GeminiLab/enumerable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

enumerable

Enumerate all possible values of a type.

Guide

use enumerable::Enumerable;

#[derive(Debug, Copy, Clone, Enumerable)]
enum Food {
    Apple,
    Banana,
    Carrot,
    Donut,
}

#[derive(Debug, Copy, Clone, Enumerable)]
struct Meal {
    alice_eats: Food,
    bob_eats: Option<Food>,
    at_home: bool,
}

fn main() {
    for meal in Meal::enumerator() {
        println!("{:?}", meal);
    }
}

See the documentation for more information.

See the examples for more examples.