asset-resolver

Crates.ioasset-resolver
lib.rsasset-resolver
version0.1.1
sourcesrc
created_at2022-01-06 02:56:09.341602
updated_at2022-01-06 02:58:12.585109
descriptionA standard system for asset path resolution
homepagehttps://github.com/ewpratten/asset-resolver-rs
repositoryhttps://github.com/ewpratten/asset-resolver-rs
max_upload_size
id508771
size45,423
Evan Pratten (ewpratten)

documentation

https://docs.rs/asset-resolver

README

Asset Resolver

Crates.io Docs.rs Build Clippy Audit

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:

  • URI to local filesystem
  • Windows to UNIX
  • Network path to mountpoint
  • Anything else

This crate provides the following resolvers:

Example Usage

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");
Commit count: 5

cargo fmt