1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use arrow2::datatypes::Field;
use arrow2_convert::field::ArrowField;

use re_types::ComponentName;

// ---

/// A type that can used as a Component of an Entity.
///
/// Examples of components include positions and colors.
pub trait LegacyComponent: ArrowField {
    /// The name of the component.
    fn legacy_name() -> ComponentName;

    /// Create a [`Field`] for this [`LegacyComponent`].
    fn field() -> Field {
        Field::new(Self::legacy_name().as_str(), Self::data_type(), false)
    }
}