Trait rerun::sdk::Archetype

source ·
pub trait Archetype {
    type Indicator: 'static + ComponentBatch + Default;

    // Required methods
    fn name() -> ArchetypeName;
    fn display_name() -> &'static str;
    fn required_components() -> Cow<'static, [ComponentName]>;

    // Provided methods
    fn indicator() -> MaybeOwnedComponentBatch<'static> { ... }
    fn recommended_components() -> Cow<'static, [ComponentName]> { ... }
    fn optional_components() -> Cow<'static, [ComponentName]> { ... }
    fn all_components() -> Cow<'static, [ComponentName]> { ... }
    fn from_arrow(
        data: impl IntoIterator<Item = (Field, Box<dyn Array>)>
    ) -> Result<Self, DeserializationError>
       where Self: Sized { ... }
    fn from_arrow_components(
        data: impl IntoIterator<Item = (ComponentName, Box<dyn Array>)>
    ) -> Result<Self, DeserializationError>
       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 Associated Types§

source

type Indicator: 'static + ComponentBatch + Default

The associated indicator component, whose presence indicates that the high-level archetype-based APIs were used to log the data.

§Internal representation

Indicator components are always unit-length null arrays. Their names follow the pattern rerun.components.{ArchetypeName}Indicator, e.g. rerun.components.Points3DIndicator.

Since null arrays aren’t actually arrays and we don’t actually have any data to shuffle around per-se, we can’t implement the usual Loggable traits. For this reason, indicator components directly implement LoggableBatch instead, and bypass the entire iterator machinery.

Required Methods§

source

fn name() -> ArchetypeName

The fully-qualified name of this archetype, e.g. rerun.archetypes.Points2D.

source

fn display_name() -> &'static str

Readable name for displaying in ui.

source

fn required_components() -> Cow<'static, [ComponentName]>

Returns the names of all components that must be provided by the user when constructing this archetype.

Provided Methods§

source

fn indicator() -> MaybeOwnedComponentBatch<'static>

Creates a ComponentBatch out of the associated Self::Indicator component.

This allows for associating arbitrary indicator components with arbitrary data. Check out the manual_indicator API example to see what’s possible.

source

fn recommended_components() -> Cow<'static, [ComponentName]>

Returns the names of all components that should be provided by the user when constructing this archetype.

source

fn optional_components() -> Cow<'static, [ComponentName]>

Returns the names of all components that may be provided by the user when constructing this archetype.

source

fn all_components() -> Cow<'static, [ComponentName]>

Returns the names of all components 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 components statically, you can override this method to get rid of the extra allocations.

source

fn from_arrow( data: impl IntoIterator<Item = (Field, Box<dyn Array>)> ) -> Result<Self, DeserializationError>
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.

source

fn from_arrow_components( data: impl IntoIterator<Item = (ComponentName, Box<dyn Array>)> ) -> Result<Self, DeserializationError>
where Self: Sized,

Given an iterator of Arrow arrays and their respective ComponentNames, deserializes them into this archetype.

Arrow arrays that are unknown to this Archetype will simply be ignored and a warning logged to stderr.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Archetype for MyPoints

source§

impl Archetype for Background

source§

impl Archetype for DataframeQuery

source§

impl Archetype for MapBackground

source§

impl Archetype for MapZoom

source§

impl Archetype for PlotLegend

source§

impl Archetype for ScalarAxis

source§

impl Archetype for SpaceViewBlueprint

source§

impl Archetype for SpaceViewContents

source§

impl Archetype for TensorScalarMapping

source§

impl Archetype for TensorSliceSelection

source§

impl Archetype for TensorViewFit

source§

impl Archetype for VisibleTimeRanges

source§

impl Archetype for VisualBounds2D

source§

impl Archetype for AffixFuzzer1

source§

impl Archetype for AffixFuzzer2

source§

impl Archetype for AffixFuzzer3

source§

impl Archetype for AffixFuzzer4

source§

impl Archetype for ContainerBlueprint

source§

impl Archetype for PanelBlueprint

source§

impl Archetype for ViewportBlueprint

source§

impl Archetype for AnnotationContext

source§

impl Archetype for Arrows2D

source§

impl Archetype for Arrows3D

source§

impl Archetype for Asset3D

source§

impl Archetype for AssetVideo

source§

impl Archetype for BarChart

source§

impl Archetype for Boxes2D

source§

impl Archetype for Boxes3D

source§

impl Archetype for Capsules3D

source§

impl Archetype for Clear

source§

impl Archetype for DepthImage

source§

impl Archetype for DisconnectedSpace

source§

impl Archetype for Ellipsoids3D

source§

impl Archetype for EncodedImage

source§

impl Archetype for GeoLineStrings

source§

impl Archetype for GeoPoints

source§

impl Archetype for Image

source§

impl Archetype for InstancePoses3D

source§

impl Archetype for LineStrips2D

source§

impl Archetype for LineStrips3D

source§

impl Archetype for Mesh3D

source§

impl Archetype for Pinhole

source§

impl Archetype for Points2D

source§

impl Archetype for Points3D

source§

impl Archetype for Scalar

source§

impl Archetype for SegmentationImage

source§

impl Archetype for SeriesLine

source§

impl Archetype for SeriesPoint

source§

impl Archetype for Tensor

source§

impl Archetype for TextDocument

source§

impl Archetype for TextLog

source§

impl Archetype for Transform3D

source§

impl Archetype for VideoFrameReference

source§

impl Archetype for ViewCoordinates