fix voxygen compilation without plugins, part 2

This commit is contained in:
Christof Petig
2023-10-23 22:08:16 +02:00
parent c354fe1b1d
commit 4ba80c0e73

View File

@ -123,7 +123,6 @@ pub trait AssetExt: Sized + Send + Sync + 'static {
}
/// Extension to AssetExt to combine Ron files from filesystem and plugins
#[cfg(feature = "plugins")]
pub trait AssetCombined: AssetExt {
fn load_and_combine(specifier: &str) -> Result<AssetHandle<Self>, BoxedError>;
@ -140,7 +139,6 @@ pub trait AssetCombined: AssetExt {
}
/// Extension to AnyCache to combine Ron files from filesystem and plugins
#[cfg(feature = "plugins")]
pub trait CacheCombined<'a> {
fn load_and_combine<A: Compound + Concatenate>(
self,
@ -201,12 +199,13 @@ impl<T: Compound> AssetExt for T {
}
}
#[cfg(feature = "plugins")]
impl<'a> CacheCombined<'a> for AnyCache<'a> {
fn load_and_combine<A: Compound + Concatenate>(
self,
specifier: &str,
) -> Result<assets_manager::Handle<'a, A>, BoxedError> {
#[cfg(feature = "plugins")]
{
self.get_cached(specifier).map_or_else(
|| {
// only create this combined object if is not yet cached
@ -220,9 +219,13 @@ impl<'a> CacheCombined<'a> for AnyCache<'a> {
Ok,
)
}
#[cfg(not(feature = "plugins"))]
{
Ok(self.load(specifier)?)
}
}
}
#[cfg(feature = "plugins")]
impl<T: Compound + Concatenate> AssetCombined for T {
fn load_and_combine(specifier: &str) -> Result<AssetHandle<Self>, BoxedError> {
ASSETS.as_any_cache().load_and_combine(specifier)