Expand description
The standard Rerun data types, component types, and archetypes.
This crate contains both the IDL definitions for Rerun types (flatbuffers) as well as the code
generated from those using re_types_builder.
Organization
definitions/contains IDL definitions for all Rerun types (data, components, archetypes).src/contains the code generated for Rust.rerun_py/rerun/rerun2/(at the root of this workspace) contains the code generated for Python.
While most of the code in this crate is auto-generated, some manual extensions are littered
throughout: look for files ending in _ext.rs or _ext.py (also see the “Extensions” section
of this document).
Build cache
Updating either the source code of the code generator itself (re_types_builder) or any of the
.fbs files should re-trigger the code generation process the next time re_types is built.
Manual extension files will be left untouched.
Caching is controlled by a versioning hash that is stored in store_hash.txt.
If you suspect something is wrong with the caching mechanism and that your changes aren’t taken
into account when they should, try and remove source_hash.txt.
If that fixes the issue, you’ve found a bug.
How-to: add a new datatype/component/archetype
Create the appropriate .fbs file in the appropriate place, and make sure it gets included in
some way (most likely indirectly) by archetypes.fbs, which is the main entrypoint for
codegen.
Generally, the easiest thing to do is to add your new type to one of the centralized manifests,
e.g. for a new component, include it into components.fbs.
Your file should get picked up automatically by the code generator. Once the code for your new component has been generated, implement whatever extensions you need and make sure to tests any custom constructors you add.
How-to: remove an existing datatype/component/archetype
Simply get rid of the type in question and rebuild re_types to trigger codegen.
Beware though: if you remove a whole definition file re-running codegen will not remove the associated generated files, you’ll have to do that yourself.
Extensions
Rust
Generated Rust code can be manually extended by adding sibling files with the _ext.rs
prefix. E.g. to extend vec2d.rs, create a vec2d_ext.rs.
Trigger the codegen (e.g. by removing source_hash.txt) to generate the right mod clauses
automatically.
The simplest way to get started is to look at any of the existing examples.
Python
Generated Python code can be manually extended by adding a sibling file with the _ext.py
prefix. E.g. to extend vec2d.py, create a vec2d_ext.py.
This sibling file needs to implement an extension class that is mixed in with the auto-generated class. The simplest way to get started is to look at any of the existing examples.
C++
Generated C++ code can be manually extended by adding a sibling file with the _ext.cpp suffix.
E.g. to extend vec2d.cpp, create a vec2d_ext.cpp.
The sibling file is compiled as-is as part of the rerun_cpp crate.
Any include directive used in the extension is automatically added to the generated header, except to the generated header itself.
In order to extend the generated type declaration in the header,
you can specify a single code-block that you want to be injected into the type declaration by
starting it with [CODEGEN COPY TO HEADER START] and ending it with [CODEGEN COPY TO HEADER END].
Note that it is your responsibility to make sure that the cpp file is valid C++ code -
the code generator & build will not adjust the extension file for you!
Modules
Structs
- Convenience-wrapper around an arrow
Bufferthat is known to contain a a primitive type. - Convenience-wrapper around an arrow
Bufferthat is known to contain a string. - The name of an entity component, e.g.
posorcolor.
Enums
Constants
- Number of decimals shown for all vector display methods.
Traits
- Anything that can be serialized to and deserialized from Arrow data.
- Approximations of stack and heap size for both internal and external types.