enum_builder 0.1.6

Simple macros that allow building enum types from variants that can be defined in multiple dispersed files in the crate.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use enum_builder::enum_builder_variant;

use crate::AnimalSound;

#[enum_builder_variant(Animal)]
pub struct Chicken<'a> {
	pub count: &'a usize,
}

impl<'a> AnimalSound for Chicken<'a> {
	fn speak(&self) {
		println!("The chicken goes{}", " cluck!".repeat(*self.count));
	}
}