pub struct InitTree { /* private fields */ }
Expand description
A tree of types to initialize.
Implementations§
Source§impl InitTree
impl InitTree
pub fn new() -> Self
Sourcepub fn enable_caching(&mut self, enabled: bool)
pub fn enable_caching(&mut self, enabled: bool)
InitTree supports the use of a cache between initializations. It’s common for the initialization sequence to be identical between runs. If you find that the process of discovering dependencies is slowing down your initialization you can cache the results of this discovery to make future initializations faster.
One might for example serialize the cache to a file after initialization and load it from that file when initializing in the future.
Sourcepub fn load_cache(&mut self, cache: Cache) -> Option<Cache>
pub fn load_cache(&mut self, cache: Cache) -> Option<Cache>
Loads a new cache in, returning the old one, if any. This will automatically enable caching.
Sourcepub fn init(self) -> InitializedTree
pub fn init(self) -> InitializedTree
Initializes the tree, returning a fully initialized tree, and if caching is enabled, a cache from this initialization.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InitTree
impl RefUnwindSafe for InitTree
impl Send for InitTree
impl Sync for InitTree
impl Unpin for InitTree
impl UnwindSafe for InitTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more