pub trait Archetype {
// Required methods
fn name() -> ArchetypeName;
fn display_name() -> &'static str;
fn required_components() -> Cow<'static, [ComponentDescriptor]>;
// Provided methods
fn recommended_components() -> Cow<'static, [ComponentDescriptor]> { ... }
fn optional_components() -> Cow<'static, [ComponentDescriptor]> { ... }
fn all_components() -> Cow<'static, [ComponentDescriptor]> { ... }
fn all_component_identifiers() -> impl Iterator<Item = ComponentIdentifier> { ... }
fn from_arrow(
data: impl IntoIterator<Item = (Field, ArrayRef)>,
) -> DeserializationResult<Self>
where Self: Sized { ... }
fn from_arrow_components(
data: impl IntoIterator<Item = (ComponentDescriptor, ArrayRef)>,
) -> DeserializationResult<Self>
where Self: Sized { ... }
}Expand description
An archetype is a high-level construct that represents a set of Components that usually
play well with each other (i.e. they compose nicely).
Internally, it is no different than a collection of components, but working at that higher layer of abstraction opens opportunities for nicer APIs & tools that wouldn’t be possible otherwise.
E.g. consider the crate::archetypes::Points3D archetype, which represents the set of
components to consider when working with a 3D point cloud within Rerun.
Required Methods§
Sourcefn name() -> ArchetypeName
fn name() -> ArchetypeName
The fully-qualified name of this archetype, e.g. rerun.archetypes.Points2D.
Sourcefn display_name() -> &'static str
fn display_name() -> &'static str
Readable name for displaying in UI.
Sourcefn required_components() -> Cow<'static, [ComponentDescriptor]>
fn required_components() -> Cow<'static, [ComponentDescriptor]>
Returns all component descriptors that must be provided by the user when constructing this archetype.
Provided Methods§
Sourcefn recommended_components() -> Cow<'static, [ComponentDescriptor]>
fn recommended_components() -> Cow<'static, [ComponentDescriptor]>
Returns all component descriptors that should be provided by the user when constructing this archetype.
Sourcefn optional_components() -> Cow<'static, [ComponentDescriptor]>
fn optional_components() -> Cow<'static, [ComponentDescriptor]>
Returns all component descriptors that may be provided by the user when constructing this archetype.
Sourcefn all_components() -> Cow<'static, [ComponentDescriptor]>
fn all_components() -> Cow<'static, [ComponentDescriptor]>
Returns all component descriptors that must, should and may be provided by the user when constructing this archetype.
The default implementation always does the right thing, at the cost of some runtime allocations. If you know all your component descriptors statically, you can override this method to get rid of the extra allocations.
Sourcefn all_component_identifiers() -> impl Iterator<Item = ComponentIdentifier>
fn all_component_identifiers() -> impl Iterator<Item = ComponentIdentifier>
Utility method based on Self::all_components to return all component identifiers.
Sourcefn from_arrow(
data: impl IntoIterator<Item = (Field, ArrayRef)>,
) -> DeserializationResult<Self>where
Self: Sized,
fn from_arrow(
data: impl IntoIterator<Item = (Field, ArrayRef)>,
) -> DeserializationResult<Self>where
Self: Sized,
Given an iterator of Arrow arrays and their respective field metadata, deserializes them into this archetype.
Arrow arrays that are unknown to this Archetype will simply be ignored and a warning
logged to stderr.
Sourcefn from_arrow_components(
data: impl IntoIterator<Item = (ComponentDescriptor, ArrayRef)>,
) -> DeserializationResult<Self>where
Self: Sized,
fn from_arrow_components(
data: impl IntoIterator<Item = (ComponentDescriptor, ArrayRef)>,
) -> DeserializationResult<Self>where
Self: Sized,
Given an iterator of Arrow arrays and their respective ComponentDescriptors, deserializes them
into this archetype.
Arrow arrays that are unknown to this Archetype will simply be ignored and a warning
logged to stderr.
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.