re_types

Trait AsComponents

Source
pub trait AsComponents {
    // Required method
    fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>;

    // Provided method
    fn to_arrow(
        &self,
    ) -> Result<Vec<(Field, Box<dyn Array>)>, SerializationError> { ... }
}
Expand description

Describes the interface for interpreting an object as a bundle of Components.

§Custom bundles

While, in most cases, component bundles are code generated from our IDL definitions, it is possible to manually extend existing bundles, or even implement fully custom ones.

All AsComponents methods are optional to implement, with the exception of AsComponents::as_component_batches, which describes how the bundle can be interpreted as a set of ComponentBatches: arrays of components that are ready to be serialized.

Have a look at our Custom Data Loader example to learn more about handwritten bundles.

Required Methods§

Source

fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>

Exposes the object’s contents as a set of ComponentBatchs.

This is the main mechanism for easily extending builtin archetypes or even writing fully custom ones. Have a look at our Custom Data Loader example to learn more about extending archetypes.

Provided Methods§

Source

fn to_arrow(&self) -> Result<Vec<(Field, Box<dyn Array>)>, SerializationError>

Serializes all non-null Components of this bundle into Arrow arrays.

The default implementation will simply serialize the result of Self::as_component_batches as-is, which is what you want in 99.9% of cases.

Implementors§

Source§

impl AsComponents for AnnotationContext

Source§

impl AsComponents for Arrows2D

Source§

impl AsComponents for Arrows3D

Source§

impl AsComponents for Asset3D

Source§

impl AsComponents for AssetVideo

Source§

impl AsComponents for BarChart

Source§

impl AsComponents for Boxes2D

Source§

impl AsComponents for Boxes3D

Source§

impl AsComponents for Capsules3D

Source§

impl AsComponents for Clear

Source§

impl AsComponents for DepthImage

Source§

impl AsComponents for DisconnectedSpace

Source§

impl AsComponents for Ellipsoids3D

Source§

impl AsComponents for EncodedImage

Source§

impl AsComponents for GeoLineStrings

Source§

impl AsComponents for GeoPoints

Source§

impl AsComponents for Image

Source§

impl AsComponents for InstancePoses3D

Source§

impl AsComponents for LineStrips2D

Source§

impl AsComponents for LineStrips3D

Source§

impl AsComponents for Mesh3D

Source§

impl AsComponents for Pinhole

Source§

impl AsComponents for Points2D

Source§

impl AsComponents for Points3D

Source§

impl AsComponents for Scalar

Source§

impl AsComponents for SegmentationImage

Source§

impl AsComponents for SeriesLine

Source§

impl AsComponents for SeriesPoint

Source§

impl AsComponents for Tensor

Source§

impl AsComponents for TextDocument

Source§

impl AsComponents for TextLog

Source§

impl AsComponents for Transform3D

Source§

impl AsComponents for VideoFrameReference

Source§

impl AsComponents for ViewCoordinates

Source§

impl AsComponents for Background

Source§

impl AsComponents for DataframeQuery

Source§

impl AsComponents for MapBackground

Source§

impl AsComponents for MapZoom

Source§

impl AsComponents for PlotLegend

Source§

impl AsComponents for ScalarAxis

Source§

impl AsComponents for SpaceViewBlueprint

Source§

impl AsComponents for SpaceViewContents

Source§

impl AsComponents for TensorScalarMapping

Source§

impl AsComponents for TensorSliceSelection

Source§

impl AsComponents for TensorViewFit

Source§

impl AsComponents for VisibleTimeRanges

Source§

impl AsComponents for VisualBounds2D

Source§

impl<C> AsComponents for C
where C: Component,