furmint-resources 0.1.0

Resources abstractions for `furmint`
Documentation
//! # Resource manager for the `furmint` game engine
//! This library provides a simple resource manager for the `furmint` game engine, enabling easy management
//! of various assets, including but not limited to scenes, images, audio, fonts, etc.
#![warn(missing_docs)]

use std::path::PathBuf;
use thiserror::Error;

/// Convenience type
pub type ResourceResult<T> = Result<T, ResourceError>;

#[derive(Error, Debug)]
/// Possible errors
pub enum ResourceError {
    /// Resource was not found in the cache
    #[error("requested resource was not found in cache")]
    ResourceDoesNotExist,
    /// Loader not found
    #[error("loader not found")]
    LoaderNotFound,
    /// IO error
    #[error(transparent)]
    Io(#[from] std::io::Error),
    /// Loader returned wrong type
    #[error("loader returned wrong type")]
    LoaderReturnedWrongType,
    /// Asset server doesn't support loading from file with a root path
    #[error("asset server doesn't support loading from file with a root path")]
    AssetServerUnsupported,
    /// File not found at path
    #[error("file not found at path `{0}`")]
    NotFound(PathBuf),
}

/// Module providing the asset server
pub mod assets;
/// Module providing asset loader traits
pub mod loader;
/// All the things to represent a resource type
pub mod resource;