#asset #assets #cache #resources


Conveniently load, store and cache external resources

4 releases

✓ Uses Rust 2018 edition

new 0.1.3 Mar 23, 2020
0.1.2 Mar 19, 2020
0.1.1 Mar 19, 2020
0.1.0 Mar 18, 2020

#17 in Caching

Download history 136/week @ 2020-03-16

60 downloads per month


601 lines


Crates.io Docs.rs

Conveniently load, store and cache external resources.

It has multiple goals:

  • Easy to use
  • Light: Pay for what you take, no dependency bloat
  • Fast: Share your resources between threads without using expensive Arc::clone

This crate follow semver convention and supports rustc 1.40.0 and higher. Changing this is considered a breaking change.

Note: this crate is still under developpement and should be considered experimental, but use and feedback and requests are welcome and encouraged.


Suppose that you have a file assets/common/test.ron containing this:

    x: 5,
    y: -6,

Then you can load it this way (with feature ron enabled):

use assets_manager::{Asset, AssetCache, loader};
use serde::Deserialize;

// The struct you want to load
struct Point {
    x: i32,
    y: i32,

// Specify how you want the structure to be loaded
impl Asset for Point {
    // The extension of the files to look into
    const EXT: &'static str = "ron";

    // The serialization format
    type Loader = loader::RonLoader;

// Create a new cache to load assets under the "./assets" folder
let cache = AssetCache::new("assets");

// Get a lock on the asset
// This will load the file `./assets/common/test.ron`
let asset_lock = cache.load::<Point>("common.test")?;

// Lock the asset for reading
// Any number of read locks can exist at the same time,
// but none can exist when the asset is reloaded
let point = asset_lock.read();

// The asset is now ready to be used
assert_eq!(point.x, 5);
assert_eq!(point.y, -6);

// Loading the same asset retreives it from the cache
let other_lock = cache.load("common.test")?;


Current features:

  • Convenient load of external files
  • Cache loaded assets
  • Thought for multi-threading
  • Built-in support of most common data formats with serde

Planned features:

  • Hot-reloading
  • Load from different sources (archives, embeded)


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~10K SLoC