pub fn with_source<I, O>(self, name: I, store: O) -> Self
    where
        I: Into<String>,
        O: Source,
    {
        {
            let mut loader = self.world.write_resource::<Loader>();
            loader.add_source(name, store);
        }
        self
    }
/// Register an asset store with the loader logic of the Application.
///
/// If the asset store exists, that shares a name with the new store the net
/// effect will be a replacement of the older store with the new one.
/// No warning or panic will result from this action.
///
/// # Parameters
///
/// - `name`: A unique name or key to identify the asset storage location. `name`
///           is used later to specify where the asset should be loaded from.
/// - `store`: The asset store being registered.
///
/// # Type Parameters
///
/// - `I`: A `String`, or a type that can be converted into a`String`.
/// - `S`: A `Store` asset loader. Typically this is a [`Directory`](../amethyst_assets/struct.Directory.html).
///
/// # Returns
///
/// This function returns ApplicationBuilder after it has modified it.
///
/// # Examples
///
/// ~~~no_run
/// use amethyst::prelude::*;
/// use amethyst::assets::{Directory, Loader};
/// use amethyst::renderer::ObjFormat;
/// use amethyst::ecs::prelude::World;
///
/// let mut game = Application::build("assets/", LoadingState)
///     .expect("Failed to initialize")
///     // Register the directory "custom_directory" under the name "resources".
///     .with_source("custom_store", Directory::new("custom_directory"))
///     .build(GameDataBuilder::default())
///     .expect("Failed to build game")
///     .run();
///
/// struct LoadingState;
/// impl<'a, 'b> State<GameData<'a, 'b>> for LoadingState {
///     fn on_start(&mut self, data: StateData<GameData>) {
///         let storage = data.world.read_resource();
///
///         let loader = data.world.read_resource::<Loader>();
///         // Load a teapot mesh from the directory that registered above.
///         let mesh = loader.load_from("teapot", ObjFormat, (), "custom_directory",
///                                     (), &storage);
///     }
/// }
/// ~~~
Register an asset store with the loader logic of the Application.
If the asset store exists, that shares a name with the new store the net
effect will be a replacement of the older store with the new one.
No warning or panic will result from this action.
Register an asset store with the loader logic of the Application . If the asset store exists that shares a name with the new store the net effect will be a replacement of the older store with the new one . No warning or panic will result from this action .
pub fn with_source<I, O>(self, name: I, store: O) -> Self
    where
        I: Into<String>,
        O: Source,
    {
        {
            let mut loader = self.world.write_resource::<Loader>();
            loader.add_source(name, store);
        }
        self
    }
pub fn with_source < I , O > ( self , name : I , store : O ) -> Self where I : Into < String > , O : Source , { { let mut loader = self . world . write_resource :: < Loader > ( ) ; loader . add_source ( name , store ) ; } self }
Register an asset store with the loader logic of the Application.
Register an asset store with the loader logic of the Application .
self
name
I
store
O
This function returns ApplicationBuilder after it has modified it.
This function returns ApplicationBuilder after it has modified it .
self
name
I
A unique name or key to identify the asset storage location. `name`
is used later to specify where the asset should be loaded from.
A unique name or key to identify the asset storage location . ` name ` is used later to specify where the asset should be loaded from .
store
O
The asset store being registered.
The asset store being registered .
I
A `String`, or a type that can be converted into a`String`.
A ` String ` or a type that can be converted into a ` String ` .
S
A `Store` asset loader. Typically this is a [`Directory`](../amethyst_assets/struct.Directory.html).
A ` Store ` asset loader . Typically this is a [ ` Directory ` ] ( .. / amethyst_assets / struct . Directory . html ) .
examples
~~~no_run
use amethyst::prelude::*;
use amethyst::assets::{Directory, Loader};
use amethyst::renderer::ObjFormat;
use amethyst::ecs::prelude::World.

let mut game = Application::build("assets/", LoadingState)
.expect("Failed to initialize")
Register the directory "custom_directory" under the name "resources".
.with_source("custom_store", Directory::new("custom_directory"))
.build(GameDataBuilder::default())
.expect("Failed to build game")
.run().

struct LoadingState;
impl<'a, 'b> State> for LoadingState {
fn on_start(&mut self, data: StateData) {
let storage = data.world.read_resource().

let loader = data.world.read_resource::();
Load a teapot mesh from the directory that registered above.
let mesh = loader.load_from("teapot", ObjFormat, (), "custom_directory",
(), &storage);
}
}
~~~
~~~no_run use amethyst :: prelude :: * ; use amethyst :: assets :: { Directory Loader } ; use amethyst :: renderer :: ObjFormat ; use amethyst :: ecs :: prelude :: World . let mut game = Application :: build ( " assets / " LoadingState ) . expect ( " Failed to initialize " ) Register the directory " custom_directory " under the name " resources " . . with_source ( " custom_store " Directory :: new ( " custom_directory " )) . build ( GameDataBuilder :: default () ) . expect ( " Failed to build game " ) . run () . struct LoadingState ; impl< ' a ' b > State > for LoadingState { fn on_start ( &mut self data : StateData ) { let storage = data . world . read_resource () . let loader = data . world . read_resource :: () ; Load a teapot mesh from the directory that registered above . let mesh = loader . load_from ( " teapot " ObjFormat () " custom_directory " () &storage ) ; } } ~~~