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 Archetype
s.
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.