[][src]Struct texture_bag::TextureBag

pub struct TextureBag { /* fields omitted */ }

Common structure storage with all the data to operate textures in project. Encapsulates loading logic, supports lazy loading. Note: by default, all config keys are String types. Todo: remake it on more generic usage with any displayable type, not only string.

Implementations

impl TextureBag[src]

pub fn init_eager<F>(facade: &F, config_path: Option<String>) -> TextureBag where
    F: Facade
[src]

Loads all textures described in config into memory

Panics

Method will panic if config file is missing.

pub fn init_lazy<F>(_facade: &F, config_path: Option<String>) -> TextureBag where
    F: Facade
[src]

Panics

Method will panic if config file is missing or if json format is invalid.

pub fn get_texture<F>(&mut self, texture_id: String, facade: &F) -> &Texture2d where
    F: Facade
[src]

Method tries to get texture from existing map. If texture was not found in map, method will try to get it's path from config, load texture and put it in map. Texture will also be returned. Display variable won't be used if texture was initialized on load.

Panics

Method will panic if texture file is missing.

pub fn forget(&mut self, texture_id: String)[src]

Removes texture from memory. Texture will be reloaded on next get_texture call.

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> Pointable for T

type Init = T

The type for initializers.

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.