cranpose-assets 0.1.173
“Asset loading and management utilities for Cranpose”
Release published within seven daysThree releases published within 24 hours
SHA-2560db79e5c64bdc0a2b128e26008812850a29627305dde26dabdf45c24d4c5efb3
MaleculeH(F)Md(Pa₂)
Evidence
1use super::*;
2
3fn test_asset_root() -> PathBuf {
⋯4 lines
8}
9
10#[test]
11fn an_earlier_root_wins_over_one_added_later() {
12 let base = test_asset_root().join("root-order");
13 let first = base.join …
1//! Asset loading and management primitives for Cranpose.
2
3use std::{
4 collections::HashMap,
5 fmt,
6 path::{Component, Path, PathBuf},
7 sync::{Arc, Mutex, MutexGuard, PoisonError},
8};
9
10/// Error returned by [`AssetManager`] load operations.
11#[derive(Debug)]
12pub enum AssetError {
13 /// The requested asset path is empty.
14 EmptyPath,
15 /// Asset paths must be relative to a registe …
81:2… }
82 }
83}
84
85/// Synchronous asset manager with root-based lookup and byte caching.
86#[derive(Debug)]
87pub struct AssetManager {
88 roots: Vec<P …
93:57… orking directory.
94 pub fn new() -> Self {
95 let root = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
96 Self::with_root(root)
97 }
98
99 /// Creates an asset manager with a single as …
200:8… return Err(AssetError::EmptyPath);
201 }
202 Ok(normalized)
203}
204
205#[cfg(test)]
206#[path = "tests/assets_tests.rs"]
207mod tests;
No evidence locations were recorded for this file. Raw result