Crate init_tree

Source
Expand description

If you have a collection of singletons you need to initialize, and some of those singletons are dependent on handles from other singletons, the InitTree is the structure you need. After implementing the Init trait for all of your singleton types all you need to do is add them to the InitTree, and then call .init() to receive all of your initialized types.

Modules§

internal
These items are required to be public for macros, but their direct use is discouraged.

Macros§

impl_init
Provides an impl of the Init trait for a type.

Structs§

Cache
Forwards compatible, serde compatible, opaque cache structure. Used to cache initialization sequences. Caching can be disabled by turning off the default features for this crate.
InitTree
A tree of types to initialize.
InitializedTree
A collection of all the structures after they’ve been initialized. Call .take::<MyType>() on this to obtain the newly initialized structure.

Traits§

Init
The trait that must be implemented for a type before it can be used with the InitTree. Automatically implemented for Default types.