Skip to content

Commit

Permalink
minor fixes: removed Error implementation for LoadState, added doc no…
Browse files Browse the repository at this point in the history
…tes for partial equality checks
  • Loading branch information
bugsweeper committed Mar 27, 2024
1 parent f43cc77 commit f243e36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions crates/bevy_asset/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_asset/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<AssetLoadError>),
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f243e36

Please sign in to comment.