furmint_resources/lib.rs
1//! # Resource manager for the `furmint` game engine
2//! This library provides a simple resource manager for the `furmint` game engine, enabling easy management
3//! of various assets, including but not limited to scenes, images, audio, fonts, etc.
4#![warn(missing_docs)]
5
6use std::path::PathBuf;
7use thiserror::Error;
8
9/// Convenience type
10pub type ResourceResult<T> = Result<T, ResourceError>;
11
12#[derive(Error, Debug)]
13/// Possible errors
14pub enum ResourceError {
15 /// Resource was not found in the cache
16 #[error("requested resource was not found in cache")]
17 ResourceDoesNotExist,
18 /// Loader not found
19 #[error("loader not found")]
20 LoaderNotFound,
21 /// IO error
22 #[error(transparent)]
23 Io(#[from] std::io::Error),
24 /// Loader returned wrong type
25 #[error("loader returned wrong type")]
26 LoaderReturnedWrongType,
27 /// Asset server doesn't support loading from file with a root path
28 #[error("asset server doesn't support loading from file with a root path")]
29 AssetServerUnsupported,
30 /// File not found at path
31 #[error("file not found at path `{0}`")]
32 NotFound(PathBuf),
33}
34
35/// Module providing the asset server
36pub mod assets;
37/// Module providing asset loader traits
38pub mod loader;
39/// All the things to represent a resource type
40pub mod resource;