/// Test when concrete types are missing mod library; use despatma_abstract_factory::{abstract_factory, interpolate_traits}; use library::elements::{Button, Element, Window}; // Factory for a single element pub trait Factory { fn create(&self) -> Box; } // Abstract Factory for multiple elements #[abstract_factory(Factory, dyn Button, Window)] pub trait AbstractGuiFactory {} // Concrete factory implementing the abstract factory struct GnomeFactory {} impl AbstractGuiFactory for GnomeFactory {} // Implement the factory trait for each type #[interpolate_traits(Button => GnomeButton)] impl Factory for GnomeFactory { fn create(&self) -> Box { Box::new(CONCRETE::create()) } } #[interpolate_traits(Window => Window)] impl Factory for GnomeFactory { fn create(&self) -> Box { Box::new(CONCRETE::create()) } } fn main() {}