Expand description
Declarative macro that generates Requires<dyn T> impl blocks
for each provider trait on MountainEnvironment. Invoked as
impl_provider!(CommandExecutor) from the parent file.
§ProviderTraitImplMacro
Declarative macro that generates Requires<dyn T> implementations for
MountainEnvironment, eliminating the boilerplate of writing an identical
impl block for each of the 25+ provider traits.
Each invocation of impl_provider!(TraitName) expands to:
impl Requires<dyn TraitName> for MountainEnvironment {
fn Require(&self) -> Arc<dyn TraitName> {
Arc::new(self.clone())
}
}This is correct because MountainEnvironment directly implements every
provider trait, so cloning self and wrapping in Arc satisfies the
Requires<dyn T> contract. The generated code is identical to a
hand-written implementation - zero runtime overhead.
Type safety and compilation errors for missing trait implementations are
reported by the Rust compiler on the generated impl block, not on the
macro call site.