Some minor cleanups of asset_server (#4604)
# Objective - Code quality bad ## Solution - Code quality better - Using rust-analyzer's inline function and inline variable quick assists, I validated that the call to `AssetServer::new` is exactly the same code as the previous version.
This commit is contained in:
parent
45d2c78949
commit
bc7293e922
@ -60,18 +60,11 @@ pub struct AssetServerInternal {
|
||||
}
|
||||
|
||||
/// Loads assets from the filesystem on background threads
|
||||
#[derive(Clone)]
|
||||
pub struct AssetServer {
|
||||
pub(crate) server: Arc<AssetServerInternal>,
|
||||
}
|
||||
|
||||
impl Clone for AssetServer {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
server: self.server.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AssetServer {
|
||||
pub fn new<T: AssetIo>(source_io: T, task_pool: TaskPool) -> Self {
|
||||
Self::with_boxed_io(Box::new(source_io), task_pool)
|
||||
@ -629,18 +622,7 @@ mod test {
|
||||
fn setup(asset_path: impl AsRef<Path>) -> AssetServer {
|
||||
use crate::FileAssetIo;
|
||||
|
||||
AssetServer {
|
||||
server: Arc::new(AssetServerInternal {
|
||||
loaders: Default::default(),
|
||||
extension_to_loader_index: Default::default(),
|
||||
asset_sources: Default::default(),
|
||||
asset_ref_counter: Default::default(),
|
||||
handle_to_path: Default::default(),
|
||||
asset_lifecycles: Default::default(),
|
||||
task_pool: Default::default(),
|
||||
asset_io: Box::new(FileAssetIo::new(asset_path, false)),
|
||||
}),
|
||||
}
|
||||
AssetServer::new(FileAssetIo::new(asset_path, false), Default::default())
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user