mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
refactor: small adjustments
This commit is contained in:
parent
52dbfde510
commit
3ceb3a9d6d
@ -123,8 +123,7 @@ pub fn load<A: Asset + 'static>(specifier: &str) -> Result<Arc<A>, Error> {
|
||||
|
||||
/// Function used to load assets from the filesystem or the cache and return a clone.
|
||||
pub fn load_cloned<A: Asset + Clone + 'static>(specifier: &str) -> Result<A, Error> {
|
||||
let asset = load(specifier);
|
||||
asset.map(|asset: Arc<A>| (*asset).clone())
|
||||
load::<A>(specifier).map(|asset| (*asset).clone())
|
||||
}
|
||||
|
||||
/// Function used to load essential assets from the filesystem or the cache. It will panic if the asset is not found.
|
||||
@ -141,8 +140,7 @@ pub fn load_expect<A: Asset + 'static>(specifier: &str) -> Arc<A> {
|
||||
|
||||
/// Function used to load essential assets from the filesystem or the cache and return a clone. It will panic if the asset is not found.
|
||||
pub fn load_expect_cloned<A: Asset + Clone + 'static>(specifier: &str) -> A {
|
||||
let asset: Arc<A> = load_expect(specifier);
|
||||
(*asset).clone()
|
||||
load_expect::<A>(specifier).as_ref().clone()
|
||||
}
|
||||
|
||||
/// Load an asset while registering it to be watched and reloaded when it changes
|
||||
|
@ -8,7 +8,6 @@ use specs::{Component, FlaggedStorage};
|
||||
use specs_idvs::IDVStorage;
|
||||
use std::fs::File;
|
||||
use std::io::BufReader;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Tool {
|
||||
|
Loading…
Reference in New Issue
Block a user