[][src]Struct init_tree::TypeInitDef

pub struct TypeInitDef {
    pub id: fn() -> TypeId,
    pub deps: fn() -> &'static [TypeInitDef],
    pub init: fn(_: &mut HashMap<TypeId, Box<dyn Any>>) -> Box<dyn Any>,
    pub name: &'static str,
}

Largely an implementation detail. However you may need to create one of these if you're manually implementing Init.

Fields

id: fn() -> TypeIddeps: fn() -> &'static [TypeInitDef]init: fn(_: &mut HashMap<TypeId, Box<dyn Any>>) -> Box<dyn Any>name: &'static str

Methods

impl TypeInitDef[src]

pub fn new(
    id: fn() -> TypeId,
    deps: fn() -> &'static [TypeInitDef],
    init: fn(_: &mut HashMap<TypeId, Box<dyn Any>>) -> Box<dyn Any>,
    name: &'static str
) -> Self
[src]

Creates a new instance of this type.

Arguments

id: The TypeId for the type this will be able to construct.

deps: A function returning the list of direct dependencies for the constructed type.

deep_deps: A function which will populate an empty vector with all dependencies for the constructed type. Called recursively on dependencies.

init: A function that retrieves the needed dependencies from a HashMap, initializes the type, and then returns the instance in a type erased Box.

name: The name of the type this constructs.

Trait Implementations

impl Clone for TypeInitDef[src]

impl Copy for TypeInitDef[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.