Trait planetkit::AutoResource [] [src]

pub trait AutoResource: Resource + Sized {
    fn new(world: &mut World) -> Self;

    fn ensure(world: &mut World) -> FetchMut<Self> { ... }
}

Resources that know how to ensure their existence using only a reference to a World.

Required Methods

Provided Methods

Ensure the given resource exists in the world. Returns the resource for writing; this should only be used during initialization, so contention shouldn't be an issue.

Cyclic dependencies will result in a panic.

Implementors