Skip to main content

AssetSource

Trait AssetSource 

Source
pub trait AssetSource {
    // Required methods
    fn names(&self, hash: AssetHash) -> String;
    fn find(&self, hash: AssetHash) -> Result<(AssetFormat, Vec<u8>)>;
}
Expand description

Where payloads are read back from. A trait rather than a directory because a session with no files reads its own, and the browser reads the same names out of origin storage.

Required Methods§

Source

fn names(&self, hash: AssetHash) -> String

What a report calls the payload’s home. Not a platform path — the storage underneath is what knows whether there is one — and not a promise that anything is there.

Source

fn find(&self, hash: AssetHash) -> Result<(AssetFormat, Vec<u8>)>

The payload’s bytes and the format that reads them, unverified — hydrate is what checks them.

§Errors

Whatever the backing store says when the payload is not there to be read.

Implementors§