pub trait Init: Sized {
// Required methods
fn init(
initialized: &mut HashMap<TypeId, RefCell<Box<dyn Any>>>,
) -> Option<Self>;
fn self_def() -> TypeInitDef;
fn deps_list() -> &'static [TypeInitDef];
fn deep_deps_list(t: &mut Vec<TypeInitDef>, call_depth: u32);
}
Expand description
The trait that must be implemented for a type before it can be used with the InitTree
.
Automatically implemented for Default
types.
You are discouraged from implementing this manually, and should use the impl_init
macro
instead.
Required Methods§
fn init( initialized: &mut HashMap<TypeId, RefCell<Box<dyn Any>>>, ) -> Option<Self>
fn self_def() -> TypeInitDef
fn deps_list() -> &'static [TypeInitDef]
fn deep_deps_list(t: &mut Vec<TypeInitDef>, call_depth: u32)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.