The current API relies on crate functions:
use enum_iterator::{all, Sequence};
#[derive(Debug, PartialEq, Sequence)]
enum Day { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday }
fn main() {
for day in all::<Day>() {
println!("{day:?}");
}
}
My personal aesthetic taste is for type-associated functions:
#[derive(Debug, PartialEq, enum_iterator::Sequence)]
enum Day { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday }
fn main() {
for day in Day::all() {
println!("{day:?}");
}
}
Aside from just the call-site ergonomics, this would place all of the associated methods onto the API docs for Day, making it more obvious to library consumers that these features were available.
Thoughts?
The current API relies on crate functions:
My personal aesthetic taste is for type-associated functions:
Aside from just the call-site ergonomics, this would place all of the associated methods onto the API docs for
Day, making it more obvious to library consumers that these features were available.Thoughts?