#asset #assets #cache #hot-reloading #resources


Conveniently load, cache, and reload external resources

35 releases

0.10.1 May 17, 2023
0.9.7 Feb 28, 2023
0.9.2 Dec 30, 2022
0.8.4 Aug 31, 2022
0.1.3 Mar 23, 2020

#16 in Caching

Download history 392/week @ 2023-02-06 388/week @ 2023-02-13 411/week @ 2023-02-20 346/week @ 2023-02-27 549/week @ 2023-03-06 471/week @ 2023-03-13 305/week @ 2023-03-20 466/week @ 2023-03-27 574/week @ 2023-04-03 544/week @ 2023-04-10 386/week @ 2023-04-17 386/week @ 2023-04-24 713/week @ 2023-05-01 423/week @ 2023-05-08 296/week @ 2023-05-15 300/week @ 2023-05-22

1,799 downloads per month
Used in 2 crates


5.5K SLoC


Crates.io Docs.rs Minimum rustc version

This crate aims at providing a filesystem abstraction to easily load external resources. It was originally thought for games, but can of course be used in other contexts.

Original idea was inspired by Veloren's assets system.

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


This crates focuses on:

  • Good performances:
    Crucial for perfomance-oriented applications such as games.
    Loaded assets are cached so loading one several times is as fast as loading it once. This crate was thought for use with concurrency.

  • Hot-reloading:
    Hot-reloading means updating assets in memory as soon as the corresponding file is changed, without restarting your program. It may greatly ease development.
    Your time is precious, and first-class support of hot-reloading helps you saving it.

  • Pleasant to use:
    A well-documented high-level API, easy to learn.
    Built-in support of common formats: serialization, images, sounds.
    Can load assets from a file system, a zip archive, or even embed them in a binary.

  • Lightness:
    Pay for what you take, no dependency bloat.


Suppose that you have a file assets/common/position.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 EXTENSION: &'static str = "ron";

    // The serialization format (RON)
    type Loader = loader::RonLoader;

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

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

// 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 = handle.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_handle = cache.load("common.position")?;

Hot-reloading is also very easy to use:

let cache = AssetCache::new("assets")?;
let handle = cache.load::<Point>("common.position")?;

loop {
    // Reload all cached files that changed

    // Assets are updated without any further work
    println!("Current value: {:?}", handle.read());


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.


~603K SLoC