pub struct DefaultResourceCache {
pub tilesets: HashMap<ResourcePathBuf, Arc<Tileset>>,
pub templates: HashMap<ResourcePathBuf, Arc<Template>>,
}Expand description
A cache that identifies resources by their path, storing them in a HashMap.
Fields§
§tilesets: HashMap<ResourcePathBuf, Arc<Tileset>>The tilesets cached until now.
templates: HashMap<ResourcePathBuf, Arc<Template>>The templates cached until now.
Implementations§
Source§impl DefaultResourceCache
impl DefaultResourceCache
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an empty DefaultResourceCache.
Trait Implementations§
Source§impl Debug for DefaultResourceCache
impl Debug for DefaultResourceCache
Source§impl Default for DefaultResourceCache
impl Default for DefaultResourceCache
Source§fn default() -> DefaultResourceCache
fn default() -> DefaultResourceCache
Returns the “default value” for a type. Read more
Source§impl ResourceCache for DefaultResourceCache
impl ResourceCache for DefaultResourceCache
Source§fn get_tileset(&self, path: impl AsRef<ResourcePath>) -> Option<Arc<Tileset>>
fn get_tileset(&self, path: impl AsRef<ResourcePath>) -> Option<Arc<Tileset>>
Obtains a tileset from the cache, if it exists. Read more
Source§fn insert_tileset(
&mut self,
path: impl AsRef<ResourcePath>,
tileset: Arc<Tileset>,
)
fn insert_tileset( &mut self, path: impl AsRef<ResourcePath>, tileset: Arc<Tileset>, )
Insert a new tileset into the cache. Read more
Source§fn get_template(&self, path: impl AsRef<ResourcePath>) -> Option<Arc<Template>>
fn get_template(&self, path: impl AsRef<ResourcePath>) -> Option<Arc<Template>>
Obtains a template from the cache, if it exists.
Source§fn insert_template(
&mut self,
path: impl AsRef<ResourcePath>,
tileset: Arc<Template>,
)
fn insert_template( &mut self, path: impl AsRef<ResourcePath>, tileset: Arc<Template>, )
Insert a new template into the cache.
Auto Trait Implementations§
impl Freeze for DefaultResourceCache
impl RefUnwindSafe for DefaultResourceCache
impl Send for DefaultResourceCache
impl Sync for DefaultResourceCache
impl Unpin for DefaultResourceCache
impl UnwindSafe for DefaultResourceCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more