Struct InitializedTree

Source
pub struct InitializedTree { /* private fields */ }
Expand description

A collection of all the structures after they’ve been initialized. Call .take::<MyType>() on this to obtain the newly initialized structure.

Implementations§

Source§

impl InitializedTree

Source

pub fn take<T: 'static>(&mut self) -> Option<T>

Removes the initialized structure from this tree and returns it.

Source

pub fn take_all(self) -> impl Iterator<Item = (TypeId, Box<dyn Any>)>

Returns an iterator of all initialized types.

Source

pub fn take_by_type_id(&mut self, t: TypeId) -> Option<Box<dyn Any>>

Removes the initialized structure from this tree and returns it. Prefer take() if possible, but this function is provided in case the type can’t be determined at compile time.

Source

pub fn take_cache(&mut self) -> Option<Cache>

Return the cache from this initialization.

Source

pub fn cache_was_correct(&self) -> bool

Returns true if the cache loaded in was completely correct.

Trait Implementations§

Source§

impl Default for InitializedTree

Source§

fn default() -> InitializedTree

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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

Source§

fn self_def() -> TypeInitDef

Source§

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

Source§

fn deep_deps_list(_t: &mut Vec<TypeInitDef>, _call_depth: u32)

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.