#[injectable]Expand description
Attribute macro to auto-register a concrete type as a singleton
This macro automatically:
- Derives
DefaultandClonefor the struct - Registers it as a singleton in the App container at startup
§Example
ⓘ
use ferro::injectable;
#[injectable]
pub struct AppState {
pub counter: u32,
}
// Automatically registered at startup
// Resolve via:
let state: AppState = App::get().unwrap();