Struct re_query::ArchetypeView
source · pub struct ArchetypeView<A: Archetype> { /* private fields */ }Expand description
A view of an Archetype at a particular point in time returned by crate::get_component_with_instances.
The required Components of an ArchetypeView determines the length of an entity
batch. When iterating over individual components, they will be implicitly joined onto
the required Components using InstanceKey values.
Implementations§
source§impl<A: Archetype> ArchetypeView<A>
impl<A: Archetype> ArchetypeView<A>
pub fn num_instances(&self) -> usize
sourcepub fn data_time(&self) -> Option<TimeInt>
pub fn data_time(&self) -> Option<TimeInt>
The data time of the most recent component in the view (not necessarily the primary!).
None if timeless.
sourcepub fn primary_row_id(&self) -> RowId
pub fn primary_row_id(&self) -> RowId
Returns the RowId associated with the primary component that was used to drive this
entire query.
Beware: when using this RowId for caching/versioning purposes, make sure the component
you are about to cache is in fact the primary component of the query!
See also https://github.com/rerun-io/rerun/issues/3232.
source§impl<A: Archetype> ArchetypeView<A>
impl<A: Archetype> ArchetypeView<A>
sourcepub fn iter_instance_keys(&self) -> impl ExactSizeIterator<Item = InstanceKey>
pub fn iter_instance_keys(&self) -> impl ExactSizeIterator<Item = InstanceKey>
Returns an iterator over InstanceKeys.
sourcepub fn has_component<C: Component>(&self) -> bool
pub fn has_component<C: Component>(&self) -> bool
Check if the entity has a component and its not empty
sourcepub fn iter_required_component<'a, C: Component + 'a>(
&'a self
) -> DeserializationResult<impl ExactSizeIterator<Item = C> + '_>
pub fn iter_required_component<'a, C: Component + 'a>( &'a self ) -> DeserializationResult<impl ExactSizeIterator<Item = C> + '_>
Iterate over the values of a required multi-component.
sourcepub fn required_mono_component<C: Component>(&self) -> DeserializationResult<C>
pub fn required_mono_component<C: Component>(&self) -> DeserializationResult<C>
Get a single required mono-component.
sourcepub fn iter_optional_component<'a, C: Component + Clone + 'a>(
&'a self
) -> DeserializationResult<impl ExactSizeIterator<Item = Option<C>> + '_>
pub fn iter_optional_component<'a, C: Component + Clone + 'a>( &'a self ) -> DeserializationResult<impl ExactSizeIterator<Item = Option<C>> + '_>
Iterate over optional values as native Components.
Always produces an iterator that matches the length of a primary
component by joining on the InstanceKey values.
sourcepub fn optional_mono_component<C: Component>(
&self
) -> DeserializationResult<Option<C>>
pub fn optional_mono_component<C: Component>( &self ) -> DeserializationResult<Option<C>>
Get a single optional mono-component.
sourcepub fn iter_raw_optional_component<'a, C: Component + Clone + 'a>(
&'a self
) -> DeserializationResult<Option<impl Iterator<Item = C> + '_>>
pub fn iter_raw_optional_component<'a, C: Component + Clone + 'a>( &'a self ) -> DeserializationResult<Option<impl Iterator<Item = C> + '_>>
Iterate over optional values as native Components.
The contents of the cell are returned as-is, without joining with any other component.
sourcepub fn raw_optional_mono_component<C: Component>(
&self
) -> DeserializationResult<Option<C>>
pub fn raw_optional_mono_component<C: Component>( &self ) -> DeserializationResult<Option<C>>
Get a single optional mono-component.
sourcepub fn from_components(
data_time: Option<TimeInt>,
primary_row_id: RowId,
components: impl IntoIterator<Item = ComponentWithInstances>
) -> Self
pub fn from_components( data_time: Option<TimeInt>, primary_row_id: RowId, components: impl IntoIterator<Item = ComponentWithInstances> ) -> Self
Helper function to produce an ArchetypeView from a collection of ComponentWithInstances.
sourcepub fn to_archetype(&self) -> Result<A>
pub fn to_archetype(&self) -> Result<A>
Convert an ArchetypeView back into a native Archetype instance
sourcepub fn to_data_cell_row_1<'a, C1: Component + Clone + Into<Cow<'a, C1>> + 'a>(
&self
) -> Result<DataCellRow>
pub fn to_data_cell_row_1<'a, C1: Component + Clone + Into<Cow<'a, C1>> + 'a>( &self ) -> Result<DataCellRow>
Useful for tests.
Trait Implementations§
source§impl<A: Clone + Archetype> Clone for ArchetypeView<A>
impl<A: Clone + Archetype> Clone for ArchetypeView<A>
source§fn clone(&self) -> ArchetypeView<A>
fn clone(&self) -> ArchetypeView<A>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more