examples/cpp/custom_collection_adapter/README.md
Especially when dealing with large amounts of data, it can be both slow and inconvenient to convert your data into the components & datatypes provided by the Rerun SDK in order to log it.
This example demonstrates how to solve this using rerun::ComponentAdapter for your own types:
Whenever you have data that is continuous in memory and binary compatible with an existing Rerun component,
you can adapt it to map to the respective Rerun component.
For non-temporary objects that live until rerun::RecordingStream::log returns,
it is typically safe to do so with a zero-copy "borrow".
This means that in those cases rerun::Collection will merely store a pointer and a length to your data.
While collection adapters are primarily used with components, they are also useful for all other usages of
Rerun's collection type. E.g. the backing buffer of rerun::TensorData
is also a rerun::Collection
allowing you to ingest large amounts of data without a copy and the convenience custom adapters can provide.
To build it from a checkout of the repository (requires a Rust toolchain):
cmake .
cmake --build . --target example_custom_collection_adapter
./examples/cpp/minimal/example_custom_collection_adapter