Attribute Macro teloc::inject [−][src]
#[inject]
Expand description
Macro can be used on free functions and impls, including impl traits, with only one implement
method. It will generate Dependency
impl in which calling function that will tagged by this
macro.
We recommend using this macro in production code.
Example:
ⓘ
use teloc::inject;
struct Number(u8);
#[inject]
impl Number {
fn init(number: u8) -> Self { Number(number) }
}
struct Foo {
a: Number
}
#[inject]
fn create_foo(number: Number) -> Foo {
Foo { a: number }
}