Trait Init

Source
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§

Source

fn init( initialized: &mut HashMap<TypeId, RefCell<Box<dyn Any>>>, ) -> Option<Self>

Source

fn self_def() -> TypeInitDef

Source

fn deps_list() -> &'static [TypeInitDef]

Source

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.

Implementors§

Source§

impl<T: 'static + Default> Init for T