From e35751554ac82f5f0af02e9690458f0953e09380 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 21 Oct 2026 09:12:45 +0200 Subject: refactor(engine): replace Asset::dependencies fn with visit_dependencies fn --- engine/src/model.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'engine/src/model.rs') diff --git a/engine/src/model.rs b/engine/src/model.rs index c231a9f..62cfe21 100644 --- a/engine/src/model.rs +++ b/engine/src/model.rs @@ -20,9 +20,11 @@ pub struct Model {} impl Asset for Model { - fn dependencies(&self) -> impl Iterator> + fn visit_dependencies<'this>( + &'this self, + _func: &mut dyn FnMut(crate::asset::Dependency<'this>), + ) { - [].into_iter() } } @@ -67,14 +69,14 @@ impl MaterialDescription impl Asset for MaterialDescription { - fn dependencies(&self) -> impl Iterator> + fn visit_dependencies<'this>( + &'this self, + func: &mut dyn FnMut(AssetDependency<'this>), + ) { - self.loading_material.iter().map(|material_label| { - AssetDependency::new::(AssetLabel { - path: (&*material_label.path).into(), - name: material_label.name.as_deref().map(Into::into), - }) - }) + if let Some(material_label) = &self.loading_material { + func(AssetDependency::new::(material_label.borrow())); + } } } -- cgit v1.2.3-18-g5258