Trait warmy::load::Load [] [src]

pub trait Load<C, Method = ()>: 'static + Sized where
    Method: ?Sized
{ type Key: Key + 'static; type Error: Error + 'static; fn load(
        key: Self::Key,
        storage: &mut Storage<C>,
        ctx: &mut C
    ) -> Result<Loaded<Self>, Self::Error>; fn reload(
        &self,
        key: Self::Key,
        storage: &mut Storage<C>,
        ctx: &mut C
    ) -> Result<Self, Self::Error> { ... } }

Class of types that can be loaded and reloaded.

The first type variable, C, represents the context of the loading. This will be accessed via a mutable reference when loading and reloading.

The second type variable, Method, is a tag-only value that is useful to implement several algorithms to load the same type with different methods.

Associated Types

Type of the key used to load the resource.

Type of error that might happen while loading.

Required Methods

Load a resource.

The Storage can be used to load additional resource dependencies.

The result type is used to register for dependency events. If you do not need any, you can lift your return value in Loaded<_> with your_value.into().

Provided Methods

Function called when a resource must be reloaded.

The default implementation of that function calls load and returns its result.

Implementors