#[non_exhaustive]pub enum ComponentError {
Unknown {
name: String,
known: Vec<&'static str>,
},
Missing {
entity: Entity,
component: &'static str,
source: EntityAccessError,
},
Allocate(AllocError),
Reflect(ReflectError),
Materialize(ShapeMismatchError),
Encode {
component: &'static str,
source: SerializeError<JsonSerializeError>,
},
Decode {
component: &'static str,
source: Box<DeserializeError>,
},
}reflect only.Expand description
Why the registry could not address a component.
A lookup fails for its own reason – an unknown name, a handle the scope cannot reach, a value that will not fit its shape – so each case keeps the handle, the component name and the underlying error rather than flattening them into one line of text.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Unknown
No submitted entry answers to this name.
Fields
Missing
The entity does not carry the component, or this scope cannot reach it.
Fields
source: EntityAccessErrorWhy the lookup was refused: a dead handle, one out of the scope’s reach, or one whose archetype lacks the component.
Allocate(AllocError)
The reflection could not lay out a value for the component.
Reflect(ReflectError)
A partial value was navigated or built wrongly.
Materialize(ShapeMismatchError)
The built value was not the component it was built as.
Encode
The component could not be written as JSON.
Fields
source: SerializeError<JsonSerializeError>Why the serializer gave up.
Decode
The text could not be read into the component.
Trait Implementations§
Source§impl Debug for ComponentError
impl Debug for ComponentError
Source§impl Display for ComponentError
impl Display for ComponentError
Source§impl Error for ComponentError
impl Error for ComponentError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()