Trait re_types::ComponentBatch

source ·
pub trait ComponentBatch: LoggableBatch {
    // Required method
    fn descriptor(&self) -> Cow<'_, ComponentDescriptor>;

    // Provided methods
    fn to_arrow_list_array(
        &self,
    ) -> Result<GenericListArray<i32>, SerializationError> { ... }
    fn serialized(&self) -> Option<SerializedComponentBatch> { ... }
    fn try_serialized(
        &self,
    ) -> Result<SerializedComponentBatch, SerializationError> { ... }
    fn name(&self) -> ComponentName { ... }
}
Expand description

A ComponentBatch represents an array’s worth of Component instances.

Required Methods§

source

fn descriptor(&self) -> Cow<'_, ComponentDescriptor>

Returns the complete ComponentDescriptor for this ComponentBatch.

Every component batch is uniquely identified by its ComponentDescriptor.

Provided Methods§

source

fn to_arrow_list_array( &self, ) -> Result<GenericListArray<i32>, SerializationError>

Serializes the batch into an Arrow list array with a single component per list.

source

fn serialized(&self) -> Option<SerializedComponentBatch>

Serializes the contents of this ComponentBatch.

Once serialized, the data is ready to be logged into Rerun via the AsComponents trait.

§Fallibility

There are very few ways in which serialization can fail, all of which are very rare to hit in practice. One such example is trying to serialize data with more than 2^31 elements into a ListArray.

For that reason, this method favors a nice user experience over error handling: errors will merely be logged, not returned (except in debug builds, where all errors panic).

See also ComponentBatch::try_serialized.

source

fn try_serialized(&self) -> Result<SerializedComponentBatch, SerializationError>

Serializes the contents of this ComponentBatch.

Once serialized, the data is ready to be logged into Rerun via the AsComponents trait.

§Fallibility

There are very few ways in which serialization can fail, all of which are very rare to hit in practice.

For that reason, it generally makes sense to favor a nice user experience over error handling in most cases, see ComponentBatch::serialized.

source

fn name(&self) -> ComponentName

The fully-qualified name of this component batch, 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.

Implementations on Foreign Types§

source§

impl<C> ComponentBatch for Option<C>
where C: Component,

source§

impl<C> ComponentBatch for [C]
where C: Component,

source§

impl<C> ComponentBatch for Vec<Option<C>>
where C: Component,

source§

impl<C> ComponentBatch for Vec<C>
where C: Component,

source§

impl<C> ComponentBatch for [Option<C>]
where C: Component,

source§

impl<C, const N: usize> ComponentBatch for [C; N]
where C: Component,

source§

impl<C, const N: usize> ComponentBatch for [Option<C>; N]
where C: Component,

Implementors§