1 2 3 4 5 6 7 8 9 10 11 12
use enum_builder::enum_builder_variant; use crate::AnimalSound; #[enum_builder_variant(Animal)] pub struct Goat(pub usize); impl<'a> AnimalSound for Goat { fn speak(&self) { println!("The goat goes{}", " bleat!".repeat(self.0)); } }