#![doc = document_features::document_features!()]
pub const DEFAULT_DISPLAY_DECIMALS: usize = 3;
mod archetype;
pub mod arrow_helpers;
mod arrow_string;
pub mod arrow_zip_validity;
mod as_components;
mod component_batch;
mod component_descriptor;
mod id;
mod loggable;
pub mod reflection;
mod result;
mod tuid;
mod view;
mod wrapper_component;
pub use self::{
archetype::{Archetype, ArchetypeName, ArchetypeReflectionMarker, ComponentIdentifier},
arrow_string::ArrowString,
as_components::AsComponents,
component_batch::{ComponentBatch, SerializedComponentBatch, SerializedComponentColumn},
component_descriptor::{
ComponentDescriptor, FIELD_METADATA_KEY_ARCHETYPE, FIELD_METADATA_KEY_COMPONENT,
FIELD_METADATA_KEY_COMPONENT_TYPE,
},
id::{ChunkId, RowId},
loggable::{
Component, ComponentSet, ComponentType, DatatypeName, Loggable, UnorderedComponentSet,
},
result::{
_Backtrace, DeserializationError, DeserializationResult, ResultExt, SerializationError,
SerializationResult,
},
tuid::tuids_to_arrow,
view::{View, ViewClassIdentifier},
wrapper_component::WrapperComponent,
};
pub mod archetypes;
pub mod components;
pub mod datatypes;
#[path = "macros.rs"]
mod _macros;
pub mod macros {
pub use super::impl_into_cow;
}
pub mod external {
pub use anyhow;
pub use arrow;
pub use re_tuid;
}
#[macro_export]
macro_rules! static_assert_struct_has_fields {
($strct:ty, $($field:ident: $field_typ:ty),+ $(,)?) => {
const _: fn(&$strct) = |s: &$strct| {
$(let _: &$field_typ = &s.$field;)+
};
}
}
#[doc(hidden)] #[expect(clippy::unnecessary_wraps)] pub fn try_serialize_field<L: Loggable>(
descriptor: ComponentDescriptor,
instances: impl IntoIterator<Item = impl Into<L>>,
) -> Option<SerializedComponentBatch> {
let res = L::to_arrow(
instances
.into_iter()
.map(|v| std::borrow::Cow::Owned(v.into())),
);
match res {
Ok(array) => Some(SerializedComponentBatch::new(array, descriptor)),
#[cfg(debug_assertions)]
Err(err) => {
panic!(
"failed to serialize data for {descriptor}: {}",
re_error::format_ref(&err)
)
}
#[cfg(not(debug_assertions))]
Err(err) => {
re_log::error!(
%descriptor,
"failed to serialize data: {}",
re_error::format_ref(&err)
);
None
}
}
}