Announcing shaku, a dependency injection library

crate, docs, repo, rocket integration

I've been working on this crate for the past few months, and now I think it's ready to see what others think of it. Shaku is a dependency injection library which, unlike most other Rust DI libraries, allows you to have both long living and temporary services, and checks dependencies at application startup.

For example, a database connection pool lives for the application lifetime, but the connections it provides may only live for the lifetime of a request (temporary service). If a service is registered that requires a connection, but no registered service provides a connection, then an error will be thrown on startup (when building the DI container).

Most of the work is taken care of by a (optional) derive macro, so there is minimal boilerplate. See the getting started guide on the docs for a walkthrough!

I'm really interested in what you think of the API, usability, documentation, etc, so please open issues! I plan on continuing development of the crate and getting it to 1.0 (and beyond), so your thoughts would be greatly appreciated.

Reddit thread


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.