pub trait Component: Loggable {
// Required method
fn descriptor() -> ComponentDescriptor;
// Provided method
fn name() -> ComponentName { ... }
}Expand description
A Component describes semantic data that can be used by any number of Archetypes.
Implementing the Component trait automatically derives the ComponentBatch implementation,
which makes it possible to work with lists’ worth of data in a generic fashion.
Required Methods§
Sourcefn descriptor() -> ComponentDescriptor
fn descriptor() -> ComponentDescriptor
Returns the complete ComponentDescriptor for this Component.
Every component is uniquely identified by its ComponentDescriptor.
Provided Methods§
Sourcefn name() -> ComponentName
fn name() -> ComponentName
The fully-qualified name of this component, e.g. rerun.components.Position2D.
This is a trivial but useful helper for Self::descriptor().component_name.
The default implementation already does the right thing: do not override unless you know
what you’re doing.
Self::name() must exactly match the value returned by Self::descriptor().component_name,
or undefined behavior ensues.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.