Crates.io | asset-resolver |
lib.rs | asset-resolver |
version | 0.1.1 |
source | src |
created_at | 2022-01-06 02:56:09.341602 |
updated_at | 2022-01-06 02:58:12.585109 |
description | A standard system for asset path resolution |
homepage | https://github.com/ewpratten/asset-resolver-rs |
repository | https://github.com/ewpratten/asset-resolver-rs |
max_upload_size | |
id | 508771 |
size | 45,423 |
The Asset Resolver crate exists to allow programs to create resolvers that can convert arbitrary path strings into filesystem paths.
The goal of this crate is to provide a simple and extensible API for other crates to use to provide their own resolvers. Crates should then be able to chain together lists of various other resolvers to efficiently convert identifiers into usable absolute paths.
Example resolvers would be as follows:
This crate provides the following resolvers:
DefaultResolver
NullResolver
use asset_resolver::*;
let resolver = ResolverChain::new(vec![
Box::new(NullResolver),
Box::new(DefaultResolver),
]);
let path = resolver.resolve("/home/user/assets/test.png").unwrap();
assert_eq!(path.to_str().unwrap(), "/home/user/assets/test.png");