2 releases

0.1.1 Sep 25, 2016
0.1.0 Aug 20, 2016

#83 in Build Utils

41 downloads per month

MIT license

23KB
600 lines

indep

Dead simple Dependency Injection library in Rust.

Documentation

The library contains support for single- and multi-threaded environments. See examples/sync.rs and examples/async.rs respectively, everything is described there.

Put the following in your Cargo.toml:

[dependencies]
indep = "*"

And the following - to the crate root:

#[macro_use]
extern crate indep;
#[macro_use]
extern crate log;

Also, depending on the sync/async version of macros, you will need several usage definitions, either:

use std::rc::Rc;
use std::cell::RefCell;
use std::fmt::{Display,Formatter,Result};

or

use std::sync::Arc;
use std::sync::RwLock;
use std::fmt::{Display,Formatter,Result};

respectively, and

use your_mod::{Dependency,Dependent,Implementation};

in DI-enabled trait implementations, where your_mod is module in your project where the pool creation macro is applied.

Dependencies

None except log, which is used only to trace! dependency injections.

License

  • MIT

Dependencies

~105KB