From f243e3693859d326c822677c4e067a18d9696079 Mon Sep 17 00:00:00 2001 From: Vitaliy Sapronenko Date: Wed, 27 Mar 2024 23:35:17 +0200 Subject: [PATCH] minor fixes: removed Error implementation for LoadState, added doc notes for partial equality checks --- crates/bevy_asset/src/io/mod.rs | 2 ++ crates/bevy_asset/src/server/mod.rs | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/bevy_asset/src/io/mod.rs b/crates/bevy_asset/src/io/mod.rs index d17499b07960d8..ae10d351acd99d 100644 --- a/crates/bevy_asset/src/io/mod.rs +++ b/crates/bevy_asset/src/io/mod.rs @@ -50,6 +50,8 @@ pub enum AssetReaderError { } impl PartialEq for AssetReaderError { + /// Equality comparison for AssetReaderError::Io is partial (only through ErrorKind of inner error) + #[inline] fn eq(&self, other: &Self) -> bool { match (self, other) { (Self::NotFound(path), Self::NotFound(other_path)) => path == other_path, diff --git a/crates/bevy_asset/src/server/mod.rs b/crates/bevy_asset/src/server/mod.rs index 9d1bd917c7597f..846857efc69759 100644 --- a/crates/bevy_asset/src/server/mod.rs +++ b/crates/bevy_asset/src/server/mod.rs @@ -1194,16 +1194,15 @@ pub(crate) enum InternalAssetEvent { } /// The load state of an asset. -#[derive(Error, Component, Clone, Debug, PartialEq, Eq)] +#[derive(Component, Clone, Debug, PartialEq, Eq)] pub enum LoadState { - #[error("The asset has not started loading yet")] + /// The asset has not started loading yet NotLoaded, - #[error("The asset is in the process of loading.")] + /// The asset is in the process of loading. Loading, - #[error("The asset has been loaded and has been added to the [`World`]")] + /// The asset has been loaded and has been added to the [`World`] Loaded, /// The asset failed to load. - #[error(transparent)] Failed(Box), } @@ -1296,6 +1295,7 @@ pub struct AssetLoaderError { } impl PartialEq for AssetLoaderError { + /// Equality comparison for AssetLoaderError::error is partial (only through TypeId) #[inline] fn eq(&self, other: &Self) -> bool { self.path == other.path