pub enum AssetLoadError {
NotFound {
path: String,
},
IoError {
path: String,
message: String,
},
DecodeFailed(String),
UnsupportedFormat {
extension: String,
},
DependencyFailed {
asset_path: String,
dependency_path: String,
message: String,
},
Custom(String),
}Expand description
Errors that can occur during asset loading.
Variants§
NotFound
The asset file was not found.
IoError
Failed to read the asset file.
Fields
DecodeFailed(String)
Failed to decode/parse the asset data.
UnsupportedFormat
The asset format is not supported.
DependencyFailed
A dependency asset failed to load.
Fields
Custom(String)
A custom loader-specific error occurred.
Implementations§
Source§impl AssetLoadError
impl AssetLoadError
Sourcepub fn io_error(path: impl AsRef<Path>, error: impl Error) -> Self
pub fn io_error(path: impl AsRef<Path>, error: impl Error) -> Self
Creates an IoError from a path and error.
Sourcepub fn decode_failed(message: impl Into<String>) -> Self
pub fn decode_failed(message: impl Into<String>) -> Self
Creates a DecodeFailed error from a message.
Sourcepub fn unsupported_format(extension: impl Into<String>) -> Self
pub fn unsupported_format(extension: impl Into<String>) -> Self
Creates an UnsupportedFormat error from an extension.
Sourcepub fn dependency_failed(
asset_path: impl Into<String>,
dependency_path: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn dependency_failed( asset_path: impl Into<String>, dependency_path: impl Into<String>, message: impl Into<String>, ) -> Self
Creates a DependencyFailed error.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Returns true if this is a NotFound error.
Sourcepub fn is_io_error(&self) -> bool
pub fn is_io_error(&self) -> bool
Returns true if this is an IoError.
Sourcepub fn is_decode_failed(&self) -> bool
pub fn is_decode_failed(&self) -> bool
Returns true if this is a DecodeFailed error.
Sourcepub fn is_unsupported_format(&self) -> bool
pub fn is_unsupported_format(&self) -> bool
Returns true if this is an UnsupportedFormat error.
Sourcepub fn is_dependency_failed(&self) -> bool
pub fn is_dependency_failed(&self) -> bool
Returns true if this is a DependencyFailed error.
Trait Implementations§
Source§impl Clone for AssetLoadError
impl Clone for AssetLoadError
Source§fn clone(&self) -> AssetLoadError
fn clone(&self) -> AssetLoadError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AssetLoadError
impl Debug for AssetLoadError
Source§impl Display for AssetLoadError
impl Display for AssetLoadError
Source§impl Error for AssetLoadError
impl Error for AssetLoadError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for AssetLoadError
impl RefUnwindSafe for AssetLoadError
impl Send for AssetLoadError
impl Sync for AssetLoadError
impl Unpin for AssetLoadError
impl UnsafeUnpin for AssetLoadError
impl UnwindSafe for AssetLoadError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more