Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xaeroxe/init_tree
https://github.com/xaeroxe/init_tree
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/xaeroxe/init_tree
- Owner: Xaeroxe
- Created: 2019-09-20T06:22:56.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-14T05:49:18.000Z (almost 5 years ago)
- Last Synced: 2024-10-29T01:26:47.431Z (3 months ago)
- Language: Rust
- Size: 31.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# init_tree
During a program's initialization process it's really common for some singletons
to be dependent on other singletons. For example, Foo needs a handle to data in Bar
before Foo can be initialized. For really large software projects with many
maintainers, keeping this initialization process straight can get to be a headache.
That's where the init_tree comes in.At program startup you add all of your singletons to the tree, and then call
`init()` on the tree. It will resolve all of your data dependencies at runtime.
It does so by utilizing a trait implemented on all of your singletons, `Init`.
`Init` is implemented automatically for singletons with `Default` implemented.
The `Init` trait provides a list of dependencies, and a function to initialize the
structure with those dependencies. Additionally, a macro `impl_init!` is provided
in order to make implementing `Init` easy to do.This crate should be usable as is, however it needs better documentation and more
unit testing.