macro_rules! inject {
(
$(#[$outer:meta])*
pub struct $Name:ident {
$($viz:vis $field:ident: $FieldType:ty),*$(,)?
}
) => { ... };
}
Expand description
Syntactic sugar to make a type’s dependencies injectable.
ⓘ
inject!(
pub struct MyStruct {
some_component: SomeComponent,
some_behavior: Arc<dyn SomeBehavior>,
}
);
Under the hood, this macro implements From<&T> where T: Provides