(&mut self, key: String, value: impl Into<TextureOwner>)
| 358 | /// Cache a value with the given key. Accepts `Texture2D` or `RenderTarget`. |
| 359 | #[allow(private_bounds)] |
| 360 | pub fn cache(&mut self, key: String, value: impl Into<TextureOwner>) -> &Texture2D { |
| 361 | self.textures.insert(key.clone(), CacheEntry { frames_not_used: 0, owner: value.into() }); |
| 362 | self.textures.get(&key).unwrap().owner.texture() |
| 363 | } |
| 364 | |
| 365 | pub fn clean(&mut self) { |
| 366 | self.textures.retain(|_, entry| entry.frames_not_used <= self.max_frames_not_used); |