[][src]Struct amethyst_assets::Loader

pub struct Loader { /* fields omitted */ }

The asset loader, holding the sources and a reference to the ThreadPool.

Methods

impl Loader[src]

pub fn new<P>(directory: P, pool: Arc<ThreadPool>) -> Self where
    P: Into<PathBuf>, 
[src]

Creates a new asset loader, initializing the directory store with the given path.

pub fn add_source<I, S>(&mut self, id: I, source: S) where
    I: Into<String>,
    S: Source
[src]

Add a source to the Loader, given an id and the source.

pub fn set_hot_reload(&mut self, value: bool)[src]

If set to true, this Loader will ask formats to generate "reload instructions" which allow reloading. Calling set_hot_reload(true) does not actually enable hot reloading; this is controlled by the HotReloadStrategy resource.

pub fn load<A, F, N, P>(
    &self,
    name: N,
    format: F,
    options: F::Options,
    progress: P,
    storage: &AssetStorage<A>
) -> Handle<A> where
    A: Asset,
    F: Format<A>,
    N: Into<String>,
    P: Progress
[src]

Loads an asset with a given format from the default (directory) source. If you want to load from a custom source instead, use load_from.

See load_from for more information.

pub fn load_from<A, F, N, P, S: ?Sized>(
    &self,
    name: N,
    format: F,
    options: F::Options,
    source: &S,
    progress: P,
    storage: &AssetStorage<A>
) -> Handle<A> where
    A: Asset,
    F: Format<A> + 'static,
    N: Into<String>,
    P: Progress,
    S: AsRef<str> + Eq + Hash,
    String: Borrow<S>, 
[src]

Loads an asset with a given id and format from a custom source. The actual work is done in a worker thread, thus this method immediately returns a handle.

Parameters

  • name: this is just an identifier for the asset, most likely a file name e.g. "meshes/a.obj"
  • format: A format struct which loads bytes from a source and produces Asset::Data with them
  • options: Additional parameter to format to configure how exactly the data will be created. This could e.g. be mipmap levels for textures.
  • source: An identifier for a source which has previously been added using with_source
  • progress: A tracker which will be notified of assets which have been imported
  • storage: The asset storage which can be fetched from the ECS World using read_resource.

pub fn load_from_data<A, P>(
    &self,
    data: A::Data,
    progress: P,
    storage: &AssetStorage<A>
) -> Handle<A> where
    A: Asset,
    P: Progress
[src]

Load an asset from data and return a handle.

Auto Trait Implementations

impl Send for Loader

impl Sync for Loader

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf for SP where
    SS: SubsetOf<SP>, 

impl<T> Resource for T where
    T: Any + Send + Sync

impl<T> Any for T where
    T: Any

impl<T> Event for T where
    T: Send + Sync + 'static, 

impl<T> Erased for T

impl<T> Erased for T