Please check build logs and if you believe this is docs.rs' fault, report into this issue report.
he_di provides a derive macro to generate implementations of the Component traits for data structures defined in your crate, allowing them to be 'registered' and 'resolved' from a Container
This functionality is based on Rust's #[derive] mechanism, just like what you would use to automatically derive implementations of the built-in Clone, Copy, Debug, or other traits. It is able to generate implementations for most structs. For now enums including ones with elaborate generic types or trait bounds. On rare occasions, for an especially convoluted type you may need to implement the trait manually.
These derives require a Rust compiler version 1.15 or newer.
- Add he_di = "0.2" as a dependency in Cargo.toml.
- Add he_di_derive = "0.2" as a dependency in Cargo.toml.
- If you have a main.rs,
add #[macro_use] extern crate he_di_derivethere.
- If you have a lib.rs, add
#[macro_use] extern crate he_di_derivethere.
#[derive(Component)]on structs that you want to flag as Component which you want to inject or be injected.
- Specify the interface this Component is implementing through
- interface: for a struct, name of the Trait that this Component will implement
- inject: for a struct's property, tag a property as being a dependency to another Component (currently only supports