This commit is contained in:
theotherphil 2025-07-17 14:29:55 +08:00 committed by GitHub
commit eedcc4df56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 134 additions and 6 deletions

View File

@ -1,3 +1,5 @@
//! TODO
#[cfg(feature = "embedded_watcher")] #[cfg(feature = "embedded_watcher")]
mod embedded_watcher; mod embedded_watcher;
@ -139,6 +141,7 @@ impl EmbeddedAssetRegistry {
/// ///
/// [`load_embedded_asset!`]: crate::load_embedded_asset /// [`load_embedded_asset!`]: crate::load_embedded_asset
pub trait GetAssetServer { pub trait GetAssetServer {
/// TODO
fn get_asset_server(&self) -> &AssetServer; fn get_asset_server(&self) -> &AssetServer;
} }

View File

@ -1,3 +1,5 @@
//! TODO
#[cfg(feature = "file_watcher")] #[cfg(feature = "file_watcher")]
mod file_watcher; mod file_watcher;

View File

@ -1,3 +1,5 @@
//! TODO
//!
use crate::io::{AssetReader, AssetReaderError, PathStream, Reader}; use crate::io::{AssetReader, AssetReaderError, PathStream, Reader};
use alloc::{boxed::Box, sync::Arc}; use alloc::{boxed::Box, sync::Arc};
use bevy_platform::collections::HashMap; use bevy_platform::collections::HashMap;

View File

@ -1,3 +1,5 @@
//! TODO
use crate::io::{AssetReader, AssetReaderError, PathStream, Reader}; use crate::io::{AssetReader, AssetReaderError, PathStream, Reader};
use alloc::{borrow::ToOwned, boxed::Box, sync::Arc, vec::Vec}; use alloc::{borrow::ToOwned, boxed::Box, sync::Arc, vec::Vec};
use bevy_platform::collections::HashMap; use bevy_platform::collections::HashMap;
@ -31,14 +33,17 @@ impl Dir {
}))) })))
} }
/// TODO
pub fn insert_asset_text(&self, path: &Path, asset: &str) { pub fn insert_asset_text(&self, path: &Path, asset: &str) {
self.insert_asset(path, asset.as_bytes().to_vec()); self.insert_asset(path, asset.as_bytes().to_vec());
} }
/// TODO
pub fn insert_meta_text(&self, path: &Path, asset: &str) { pub fn insert_meta_text(&self, path: &Path, asset: &str) {
self.insert_meta(path, asset.as_bytes().to_vec()); self.insert_meta(path, asset.as_bytes().to_vec());
} }
/// TODO
pub fn insert_asset(&self, path: &Path, value: impl Into<Value>) { pub fn insert_asset(&self, path: &Path, value: impl Into<Value>) {
let mut dir = self.clone(); let mut dir = self.clone();
if let Some(parent) = path.parent() { if let Some(parent) = path.parent() {
@ -63,6 +68,7 @@ impl Dir {
dir.0.write().assets.remove(&key) dir.0.write().assets.remove(&key)
} }
/// TODO
pub fn insert_meta(&self, path: &Path, value: impl Into<Value>) { pub fn insert_meta(&self, path: &Path, value: impl Into<Value>) {
let mut dir = self.clone(); let mut dir = self.clone();
if let Some(parent) = path.parent() { if let Some(parent) = path.parent() {
@ -77,6 +83,7 @@ impl Dir {
); );
} }
/// TODO
pub fn get_or_insert_dir(&self, path: &Path) -> Dir { pub fn get_or_insert_dir(&self, path: &Path) -> Dir {
let mut dir = self.clone(); let mut dir = self.clone();
let mut full_path = PathBuf::new(); let mut full_path = PathBuf::new();
@ -94,6 +101,7 @@ impl Dir {
dir dir
} }
/// TODO
pub fn get_dir(&self, path: &Path) -> Option<Dir> { pub fn get_dir(&self, path: &Path) -> Option<Dir> {
let mut dir = self.clone(); let mut dir = self.clone();
for p in path.components() { for p in path.components() {
@ -104,6 +112,7 @@ impl Dir {
Some(dir) Some(dir)
} }
/// TODO
pub fn get_asset(&self, path: &Path) -> Option<Data> { pub fn get_asset(&self, path: &Path) -> Option<Data> {
let mut dir = self.clone(); let mut dir = self.clone();
if let Some(parent) = path.parent() { if let Some(parent) = path.parent() {
@ -114,6 +123,7 @@ impl Dir {
.and_then(|f| dir.0.read().assets.get(f.to_str().unwrap()).cloned()) .and_then(|f| dir.0.read().assets.get(f.to_str().unwrap()).cloned())
} }
/// TODO
pub fn get_metadata(&self, path: &Path) -> Option<Data> { pub fn get_metadata(&self, path: &Path) -> Option<Data> {
let mut dir = self.clone(); let mut dir = self.clone();
if let Some(parent) = path.parent() { if let Some(parent) = path.parent() {
@ -124,11 +134,13 @@ impl Dir {
.and_then(|f| dir.0.read().metadata.get(f.to_str().unwrap()).cloned()) .and_then(|f| dir.0.read().metadata.get(f.to_str().unwrap()).cloned())
} }
/// TODO
pub fn path(&self) -> PathBuf { pub fn path(&self) -> PathBuf {
self.0.read().path.to_owned() self.0.read().path.to_owned()
} }
} }
/// TODO
pub struct DirStream { pub struct DirStream {
dir: Dir, dir: Dir,
index: usize, index: usize,
@ -176,6 +188,7 @@ impl Stream for DirStream {
/// This is primarily intended for unit tests. /// This is primarily intended for unit tests.
#[derive(Default, Clone)] #[derive(Default, Clone)]
pub struct MemoryAssetReader { pub struct MemoryAssetReader {
/// TODO
pub root: Dir, pub root: Dir,
} }
@ -189,7 +202,9 @@ pub struct Data {
/// Stores either an allocated vec of bytes or a static array of bytes. /// Stores either an allocated vec of bytes or a static array of bytes.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Value { pub enum Value {
/// TODO
Vec(Arc<Vec<u8>>), Vec(Arc<Vec<u8>>),
/// TODO
Static(&'static [u8]), Static(&'static [u8]),
} }

View File

@ -1,3 +1,5 @@
//! TODO
#[cfg(all(feature = "file_watcher", target_arch = "wasm32"))] #[cfg(all(feature = "file_watcher", target_arch = "wasm32"))]
compile_error!( compile_error!(
"The \"file_watcher\" feature for hot reloading does not work \ "The \"file_watcher\" feature for hot reloading does not work \
@ -135,6 +137,7 @@ pub trait AsyncSeekForwardExt: AsyncSeekForward {
impl<R: AsyncSeekForward + ?Sized> AsyncSeekForwardExt for R {} impl<R: AsyncSeekForward + ?Sized> AsyncSeekForwardExt for R {}
/// TODO
#[derive(Debug)] #[derive(Debug)]
#[must_use = "futures do nothing unless you `.await` or poll them"] #[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct SeekForwardFuture<'a, S: Unpin + ?Sized> { pub struct SeekForwardFuture<'a, S: Unpin + ?Sized> {
@ -188,6 +191,7 @@ impl Reader for Box<dyn Reader + '_> {
pub trait AssetReaderFuture: pub trait AssetReaderFuture:
ConditionalSendFuture<Output = Result<Self::Value, AssetReaderError>> ConditionalSendFuture<Output = Result<Self::Value, AssetReaderError>>
{ {
/// TODO
type Value; type Value;
} }
@ -326,8 +330,10 @@ impl<T: AssetReader> ErasedAssetReader for T {
} }
} }
/// TODO
pub type Writer = dyn AsyncWrite + Unpin + Send + Sync; pub type Writer = dyn AsyncWrite + Unpin + Send + Sync;
/// TODO
pub type PathStream = dyn Stream<Item = PathBuf> + Unpin + Send; pub type PathStream = dyn Stream<Item = PathBuf> + Unpin + Send;
/// Errors that occur while loading assets. /// Errors that occur while loading assets.
@ -583,7 +589,12 @@ pub enum AssetSourceEvent {
/// An asset at this path was removed. /// An asset at this path was removed.
RemovedAsset(PathBuf), RemovedAsset(PathBuf),
/// An asset at this path was renamed. /// An asset at this path was renamed.
RenamedAsset { old: PathBuf, new: PathBuf }, RenamedAsset {
/// TODO
old: PathBuf,
/// TODO
new: PathBuf
},
/// Asset metadata at this path was added. /// Asset metadata at this path was added.
AddedMeta(PathBuf), AddedMeta(PathBuf),
/// Asset metadata at this path was modified. /// Asset metadata at this path was modified.
@ -591,13 +602,23 @@ pub enum AssetSourceEvent {
/// Asset metadata at this path was removed. /// Asset metadata at this path was removed.
RemovedMeta(PathBuf), RemovedMeta(PathBuf),
/// Asset metadata at this path was renamed. /// Asset metadata at this path was renamed.
RenamedMeta { old: PathBuf, new: PathBuf }, RenamedMeta {
/// TODO
old: PathBuf,
/// TODO
new: PathBuf
},
/// A folder at the given path was added. /// A folder at the given path was added.
AddedFolder(PathBuf), AddedFolder(PathBuf),
/// A folder at the given path was removed. /// A folder at the given path was removed.
RemovedFolder(PathBuf), RemovedFolder(PathBuf),
/// A folder at the given path was renamed. /// A folder at the given path was renamed.
RenamedFolder { old: PathBuf, new: PathBuf }, RenamedFolder {
/// TODO
old: PathBuf,
/// TODO
new: PathBuf
},
/// Something of unknown type was removed. It is the job of the event handler to determine the type. /// Something of unknown type was removed. It is the job of the event handler to determine the type.
/// This exists because notify-rs produces "untyped" rename events without destination paths for unwatched folders, so we can't determine the type of /// This exists because notify-rs produces "untyped" rename events without destination paths for unwatched folders, so we can't determine the type of
/// the rename. /// the rename.

View File

@ -1,3 +1,5 @@
//! TODO
use crate::{ use crate::{
io::{AssetReader, AssetReaderError, AssetSourceId, PathStream, Reader}, io::{AssetReader, AssetReaderError, AssetSourceId, PathStream, Reader},
processor::{AssetProcessorData, ProcessStatus}, processor::{AssetProcessorData, ProcessStatus},

View File

@ -138,7 +138,6 @@
//! If you want to save your assets back to disk, you should implement [`AssetSaver`](saver::AssetSaver) as well. //! If you want to save your assets back to disk, you should implement [`AssetSaver`](saver::AssetSaver) as well.
//! This trait mirrors [`AssetLoader`] in structure, and works in tandem with [`AssetWriter`](io::AssetWriter), which mirrors [`AssetReader`](io::AssetReader). //! This trait mirrors [`AssetLoader`] in structure, and works in tandem with [`AssetWriter`](io::AssetWriter), which mirrors [`AssetReader`](io::AssetReader).
#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![doc( #![doc(
html_logo_url = "https://bevy.org/assets/icon.png", html_logo_url = "https://bevy.org/assets/icon.png",
@ -455,6 +454,7 @@ pub trait AsAssetId: Component {
/// ///
/// Note that this trait is automatically implemented when deriving [`Asset`]. /// Note that this trait is automatically implemented when deriving [`Asset`].
pub trait VisitAssetDependencies { pub trait VisitAssetDependencies {
/// TODO
fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId)); fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId));
} }

View File

@ -268,7 +268,9 @@ impl ErasedLoadedAsset {
/// A type erased container for an [`Asset`] value that is capable of inserting the [`Asset`] into a [`World`]'s [`Assets`] collection. /// A type erased container for an [`Asset`] value that is capable of inserting the [`Asset`] into a [`World`]'s [`Assets`] collection.
pub trait AssetContainer: Downcast + Any + Send + Sync + 'static { pub trait AssetContainer: Downcast + Any + Send + Sync + 'static {
/// TODO
fn insert(self: Box<Self>, id: UntypedAssetId, world: &mut World); fn insert(self: Box<Self>, id: UntypedAssetId, world: &mut World);
/// TODO
fn asset_type_name(&self) -> &'static str; fn asset_type_name(&self) -> &'static str;
} }
@ -291,11 +293,15 @@ impl<A: Asset> AssetContainer for A {
/// [immediately]: crate::Immediate /// [immediately]: crate::Immediate
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum LoadDirectError { pub enum LoadDirectError {
/// TODO
#[error("Requested to load an asset path ({0:?}) with a subasset, but this is unsupported. See issue #18291")] #[error("Requested to load an asset path ({0:?}) with a subasset, but this is unsupported. See issue #18291")]
RequestedSubasset(AssetPath<'static>), RequestedSubasset(AssetPath<'static>),
/// TODO
#[error("Failed to load dependency {dependency:?} {error}")] #[error("Failed to load dependency {dependency:?} {error}")]
LoadError { LoadError {
/// TODO
dependency: AssetPath<'static>, dependency: AssetPath<'static>,
/// TODO
error: AssetLoadError, error: AssetLoadError,
}, },
} }
@ -303,8 +309,10 @@ pub enum LoadDirectError {
/// An error that occurs while deserializing [`AssetMeta`]. /// An error that occurs while deserializing [`AssetMeta`].
#[derive(Error, Debug, Clone, PartialEq, Eq)] #[derive(Error, Debug, Clone, PartialEq, Eq)]
pub enum DeserializeMetaError { pub enum DeserializeMetaError {
/// TODO
#[error("Failed to deserialize asset meta: {0:?}")] #[error("Failed to deserialize asset meta: {0:?}")]
DeserializeSettings(#[from] SpannedError), DeserializeSettings(#[from] SpannedError),
/// TODO
#[error("Failed to deserialize minimal asset meta: {0:?}")] #[error("Failed to deserialize minimal asset meta: {0:?}")]
DeserializeMinimal(SpannedError), DeserializeMinimal(SpannedError),
} }
@ -568,20 +576,27 @@ impl<'a> LoadContext<'a> {
/// An error produced when calling [`LoadContext::read_asset_bytes`] /// An error produced when calling [`LoadContext::read_asset_bytes`]
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum ReadAssetBytesError { pub enum ReadAssetBytesError {
/// TODO
#[error(transparent)] #[error(transparent)]
DeserializeMetaError(#[from] DeserializeMetaError), DeserializeMetaError(#[from] DeserializeMetaError),
/// TODO
#[error(transparent)] #[error(transparent)]
AssetReaderError(#[from] AssetReaderError), AssetReaderError(#[from] AssetReaderError),
/// TODO
#[error(transparent)] #[error(transparent)]
MissingAssetSourceError(#[from] MissingAssetSourceError), MissingAssetSourceError(#[from] MissingAssetSourceError),
/// TODO
#[error(transparent)] #[error(transparent)]
MissingProcessedAssetReaderError(#[from] MissingProcessedAssetReaderError), MissingProcessedAssetReaderError(#[from] MissingProcessedAssetReaderError),
/// Encountered an I/O error while loading an asset. /// Encountered an I/O error while loading an asset.
#[error("Encountered an io error while loading asset at `{}`: {source}", path.display())] #[error("Encountered an io error while loading asset at `{}`: {source}", path.display())]
Io { Io {
/// TODO
path: PathBuf, path: PathBuf,
/// TODO
source: std::io::Error, source: std::io::Error,
}, },
/// TODO
#[error("The LoadContext for this read_asset_bytes call requires hash metadata, but it was not provided. This is likely an internal implementation error.")] #[error("The LoadContext for this read_asset_bytes call requires hash metadata, but it was not provided. This is likely an internal implementation error.")]
MissingAssetHash, MissingAssetHash,
} }

View File

@ -1,3 +1,5 @@
//! TODO
use alloc::{ use alloc::{
boxed::Box, boxed::Box,
string::{String, ToString}, string::{String, ToString},
@ -13,7 +15,10 @@ use ron::ser::PrettyConfig;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tracing::error; use tracing::error;
/// TODO
pub const META_FORMAT_VERSION: &str = "1.0"; pub const META_FORMAT_VERSION: &str = "1.0";
/// TODO
pub type MetaTransform = Box<dyn Fn(&mut dyn AssetMetaDyn) + Send + Sync>; pub type MetaTransform = Box<dyn Fn(&mut dyn AssetMetaDyn) + Send + Sync>;
/// Asset metadata that informs how an [`Asset`] should be handled by the asset system. /// Asset metadata that informs how an [`Asset`] should be handled by the asset system.
@ -36,6 +41,7 @@ pub struct AssetMeta<L: AssetLoader, P: Process> {
} }
impl<L: AssetLoader, P: Process> AssetMeta<L, P> { impl<L: AssetLoader, P: Process> AssetMeta<L, P> {
/// TODO
pub fn new(asset: AssetAction<L::Settings, P::Settings>) -> Self { pub fn new(asset: AssetAction<L::Settings, P::Settings>) -> Self {
Self { Self {
meta_format_version: META_FORMAT_VERSION.to_string(), meta_format_version: META_FORMAT_VERSION.to_string(),
@ -56,7 +62,9 @@ pub enum AssetAction<LoaderSettings, ProcessSettings> {
/// Load the asset with the given loader and settings /// Load the asset with the given loader and settings
/// See [`AssetLoader`]. /// See [`AssetLoader`].
Load { Load {
/// TODO
loader: String, loader: String,
/// TODO
settings: LoaderSettings, settings: LoaderSettings,
}, },
/// Process the asset with the given processor and settings. /// Process the asset with the given processor and settings.
@ -64,7 +72,9 @@ pub enum AssetAction<LoaderSettings, ProcessSettings> {
/// ///
/// [`AssetProcessor`]: crate::processor::AssetProcessor /// [`AssetProcessor`]: crate::processor::AssetProcessor
Process { Process {
/// TODO
processor: String, processor: String,
/// TODO
settings: ProcessSettings, settings: ProcessSettings,
}, },
/// Do nothing with the asset /// Do nothing with the asset
@ -89,7 +99,9 @@ pub struct ProcessedInfo {
/// has changed. /// has changed.
#[derive(Serialize, Deserialize, Debug, Clone)] #[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ProcessDependencyInfo { pub struct ProcessDependencyInfo {
/// TODO
pub full_hash: AssetHash, pub full_hash: AssetHash,
/// TODO
pub path: AssetPath<'static>, pub path: AssetPath<'static>,
} }
@ -101,6 +113,7 @@ pub struct ProcessDependencyInfo {
// using a type registry. // using a type registry.
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
pub struct AssetMetaMinimal { pub struct AssetMetaMinimal {
/// TODO
pub asset: AssetActionMinimal, pub asset: AssetActionMinimal,
} }
@ -108,8 +121,17 @@ pub struct AssetMetaMinimal {
/// isn't necessary. /// isn't necessary.
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
pub enum AssetActionMinimal { pub enum AssetActionMinimal {
Load { loader: String }, /// TODO
Process { processor: String }, Load {
/// TODO
loader: String
},
/// TODO
Process {
/// TODO
processor: String
},
/// TODO
Ignore, Ignore,
} }
@ -117,6 +139,7 @@ pub enum AssetActionMinimal {
/// necessary. /// necessary.
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
pub struct ProcessedInfoMinimal { pub struct ProcessedInfoMinimal {
/// TODO
pub processed_info: Option<ProcessedInfo>, pub processed_info: Option<ProcessedInfo>,
} }
@ -238,6 +261,7 @@ pub(crate) fn loader_settings_meta_transform<S: Settings>(
Box::new(move |meta| meta_transform_settings(meta, &settings)) Box::new(move |meta| meta_transform_settings(meta, &settings))
} }
/// TODO
pub type AssetHash = [u8; 32]; pub type AssetHash = [u8; 32];
/// NOTE: changing the hashing logic here is a _breaking change_ that requires a [`META_FORMAT_VERSION`] bump. /// NOTE: changing the hashing logic here is a _breaking change_ that requires a [`META_FORMAT_VERSION`] bump.

View File

@ -163,6 +163,7 @@ impl AssetProcessor {
self.data.sources.get(id.into()) self.data.sources.get(id.into())
} }
/// TODO
#[inline] #[inline]
pub fn sources(&self) -> &AssetSources { pub fn sources(&self) -> &AssetSources {
&self.data.sources &self.data.sources
@ -1171,16 +1172,22 @@ impl<T: Process> Process for InstrumentedAssetProcessor<T> {
/// The (successful) result of processing an asset /// The (successful) result of processing an asset
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum ProcessResult { pub enum ProcessResult {
/// TODO
Processed(ProcessedInfo), Processed(ProcessedInfo),
/// TODO
SkippedNotChanged, SkippedNotChanged,
/// TODO
Ignored, Ignored,
} }
/// The final status of processing an asset /// The final status of processing an asset
#[derive(Debug, PartialEq, Eq, Copy, Clone)] #[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum ProcessStatus { pub enum ProcessStatus {
/// TODO
Processed, Processed,
/// TODO
Failed, Failed,
/// TODO
NonExistent, NonExistent,
} }
@ -1467,10 +1474,13 @@ pub enum ProcessorState {
/// An error that occurs when initializing the [`AssetProcessor`]. /// An error that occurs when initializing the [`AssetProcessor`].
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum InitializeError { pub enum InitializeError {
/// TODO
#[error(transparent)] #[error(transparent)]
FailedToReadSourcePaths(AssetReaderError), FailedToReadSourcePaths(AssetReaderError),
/// TODO
#[error(transparent)] #[error(transparent)]
FailedToReadDestinationPaths(AssetReaderError), FailedToReadDestinationPaths(AssetReaderError),
/// TODO
#[error("Failed to validate asset log: {0}")] #[error("Failed to validate asset log: {0}")]
ValidateLogError(#[from] ValidateLogError), ValidateLogError(#[from] ValidateLogError),
} }

View File

@ -101,6 +101,7 @@ impl<
S: AssetSaver<Asset = T::AssetOutput>, S: AssetSaver<Asset = T::AssetOutput>,
> LoadTransformAndSave<L, T, S> > LoadTransformAndSave<L, T, S>
{ {
/// TODO
pub fn new(transformer: T, saver: S) -> Self { pub fn new(transformer: T, saver: S) -> Self {
LoadTransformAndSave { LoadTransformAndSave {
transformer, transformer,
@ -113,49 +114,70 @@ impl<
/// An error that is encountered during [`Process::process`]. /// An error that is encountered during [`Process::process`].
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum ProcessError { pub enum ProcessError {
/// TODO
#[error(transparent)] #[error(transparent)]
MissingAssetLoaderForExtension(#[from] MissingAssetLoaderForExtensionError), MissingAssetLoaderForExtension(#[from] MissingAssetLoaderForExtensionError),
/// TODO
#[error(transparent)] #[error(transparent)]
MissingAssetLoaderForTypeName(#[from] MissingAssetLoaderForTypeNameError), MissingAssetLoaderForTypeName(#[from] MissingAssetLoaderForTypeNameError),
/// TODO
#[error("The processor '{0}' does not exist")] #[error("The processor '{0}' does not exist")]
#[from(ignore)] #[from(ignore)]
MissingProcessor(String), MissingProcessor(String),
/// TODO
#[error("Encountered an AssetReader error for '{path}': {err}")] #[error("Encountered an AssetReader error for '{path}': {err}")]
#[from(ignore)] #[from(ignore)]
AssetReaderError { AssetReaderError {
/// TODO
path: AssetPath<'static>, path: AssetPath<'static>,
/// TODO
err: AssetReaderError, err: AssetReaderError,
}, },
/// TODO
#[error("Encountered an AssetWriter error for '{path}': {err}")] #[error("Encountered an AssetWriter error for '{path}': {err}")]
#[from(ignore)] #[from(ignore)]
AssetWriterError { AssetWriterError {
/// TODO
path: AssetPath<'static>, path: AssetPath<'static>,
/// TODO
err: AssetWriterError, err: AssetWriterError,
}, },
/// TODO
#[error(transparent)] #[error(transparent)]
MissingAssetWriterError(#[from] MissingAssetWriterError), MissingAssetWriterError(#[from] MissingAssetWriterError),
/// TODO
#[error(transparent)] #[error(transparent)]
MissingProcessedAssetReaderError(#[from] MissingProcessedAssetReaderError), MissingProcessedAssetReaderError(#[from] MissingProcessedAssetReaderError),
/// TODO
#[error(transparent)] #[error(transparent)]
MissingProcessedAssetWriterError(#[from] MissingProcessedAssetWriterError), MissingProcessedAssetWriterError(#[from] MissingProcessedAssetWriterError),
/// TODO
#[error("Failed to read asset metadata for {path}: {err}")] #[error("Failed to read asset metadata for {path}: {err}")]
#[from(ignore)] #[from(ignore)]
ReadAssetMetaError { ReadAssetMetaError {
/// TODO
path: AssetPath<'static>, path: AssetPath<'static>,
/// TODO
err: AssetReaderError, err: AssetReaderError,
}, },
/// TODO
#[error(transparent)] #[error(transparent)]
DeserializeMetaError(#[from] DeserializeMetaError), DeserializeMetaError(#[from] DeserializeMetaError),
/// TODO
#[error(transparent)] #[error(transparent)]
AssetLoadError(#[from] AssetLoadError), AssetLoadError(#[from] AssetLoadError),
/// TODO
#[error("The wrong meta type was passed into a processor. This is probably an internal implementation error.")] #[error("The wrong meta type was passed into a processor. This is probably an internal implementation error.")]
WrongMetaType, WrongMetaType,
/// TODO
#[error("Encountered an error while saving the asset: {0}")] #[error("Encountered an error while saving the asset: {0}")]
#[from(ignore)] #[from(ignore)]
AssetSaveError(Box<dyn core::error::Error + Send + Sync + 'static>), AssetSaveError(Box<dyn core::error::Error + Send + Sync + 'static>),
/// TODO
#[error("Encountered an error while transforming the asset: {0}")] #[error("Encountered an error while transforming the asset: {0}")]
#[from(ignore)] #[from(ignore)]
AssetTransformError(Box<dyn core::error::Error + Send + Sync + 'static>), AssetTransformError(Box<dyn core::error::Error + Send + Sync + 'static>),
/// TODO
#[error("Assets without extensions are not supported.")] #[error("Assets without extensions are not supported.")]
ExtensionRequired, ExtensionRequired,
} }

View File

@ -1,3 +1,5 @@
//! TODO
use crate::{ use crate::{
io::Writer, meta::Settings, transformer::TransformedAsset, Asset, AssetLoader, io::Writer, meta::Settings, transformer::TransformedAsset, Asset, AssetLoader,
ErasedLoadedAsset, Handle, LabeledAsset, UntypedHandle, ErasedLoadedAsset, Handle, LabeledAsset, UntypedHandle,

View File

@ -2050,20 +2050,28 @@ pub enum WaitForAssetError {
DependencyFailed(Arc<AssetLoadError>), DependencyFailed(Arc<AssetLoadError>),
} }
/// TODO
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum WriteDefaultMetaError { pub enum WriteDefaultMetaError {
/// TODO
#[error(transparent)] #[error(transparent)]
MissingAssetLoader(#[from] MissingAssetLoaderForExtensionError), MissingAssetLoader(#[from] MissingAssetLoaderForExtensionError),
/// TODO
#[error(transparent)] #[error(transparent)]
MissingAssetSource(#[from] MissingAssetSourceError), MissingAssetSource(#[from] MissingAssetSourceError),
/// TODO
#[error(transparent)] #[error(transparent)]
MissingAssetWriter(#[from] MissingAssetWriterError), MissingAssetWriter(#[from] MissingAssetWriterError),
/// TODO
#[error("failed to write default asset meta file: {0}")] #[error("failed to write default asset meta file: {0}")]
FailedToWriteMeta(#[from] AssetWriterError), FailedToWriteMeta(#[from] AssetWriterError),
/// TODO
#[error("asset meta file already exists, so avoiding overwrite")] #[error("asset meta file already exists, so avoiding overwrite")]
MetaAlreadyExists, MetaAlreadyExists,
/// TODO
#[error("encountered an I/O error while reading the existing meta file: {0}")] #[error("encountered an I/O error while reading the existing meta file: {0}")]
IoErrorFromExistingMetaCheck(Arc<std::io::Error>), IoErrorFromExistingMetaCheck(Arc<std::io::Error>),
/// TODO
#[error("encountered HTTP status {0} when reading the existing meta file")] #[error("encountered HTTP status {0} when reading the existing meta file")]
HttpErrorFromExistingMetaCheck(u16), HttpErrorFromExistingMetaCheck(u16),
} }

View File

@ -1,3 +1,5 @@
//! TODO
use crate::{meta::Settings, Asset, ErasedLoadedAsset, Handle, LabeledAsset, UntypedHandle}; use crate::{meta::Settings, Asset, ErasedLoadedAsset, Handle, LabeledAsset, UntypedHandle};
use alloc::boxed::Box; use alloc::boxed::Box;
use atomicow::CowArc; use atomicow::CowArc;