Struct rerun::external::re_viewer_context::external::re_query::ArchetypeView
source · pub struct ArchetypeView<A>where
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 Component
s of an ArchetypeView
determines the length of an entity
batch. When iterating over individual components, they will be implicitly joined onto
the required Component
s using InstanceKey
values.
Implementations§
source§impl<A> ArchetypeView<A>where
A: Archetype,
impl<A> ArchetypeView<A>where
A: Archetype,
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> ArchetypeView<A>where
A: Archetype,
impl<A> ArchetypeView<A>where
A: Archetype,
sourcepub fn iter_instance_keys(&self) -> impl ExactSizeIterator
pub fn iter_instance_keys(&self) -> impl ExactSizeIterator
Returns an iterator over InstanceKey
s.
sourcepub fn has_component<C>(&self) -> boolwhere
C: Component,
pub fn has_component<C>(&self) -> boolwhere
C: Component,
Check if the entity has a component and its not empty
sourcepub fn iter_required_component<'a, C>(
&'a self
) -> Result<impl ExactSizeIterator + 'a, DeserializationError>where
C: Component + 'a,
pub fn iter_required_component<'a, C>(
&'a self
) -> Result<impl ExactSizeIterator + 'a, DeserializationError>where
C: Component + 'a,
Iterate over the values of a required multi-component.
sourcepub fn required_mono_component<C>(&self) -> Result<C, DeserializationError>where
C: Component,
pub fn required_mono_component<C>(&self) -> Result<C, DeserializationError>where
C: Component,
Get a single required mono-component.
sourcepub fn iter_optional_component<'a, C>(
&'a self
) -> Result<impl ExactSizeIterator + 'a, DeserializationError>
pub fn iter_optional_component<'a, C>( &'a self ) -> Result<impl ExactSizeIterator + 'a, DeserializationError>
Iterate over optional values as native Component
s.
Always produces an iterator that matches the length of a primary
component by joining on the InstanceKey
values.
sourcepub fn optional_mono_component<C>(
&self
) -> Result<Option<C>, DeserializationError>where
C: Component,
pub fn optional_mono_component<C>(
&self
) -> Result<Option<C>, DeserializationError>where
C: Component,
Get a single optional mono-component.
sourcepub fn iter_raw_optional_component<'a, C>(
&'a self
) -> Result<Option<impl Iterator<Item = C> + 'a>, DeserializationError>
pub fn iter_raw_optional_component<'a, C>( &'a self ) -> Result<Option<impl Iterator<Item = C> + 'a>, DeserializationError>
Iterate over optional values as native Component
s.
The contents of the cell are returned as-is, without joining with any other component.
sourcepub fn raw_optional_mono_component<C>(
&self
) -> Result<Option<C>, DeserializationError>where
C: Component,
pub fn raw_optional_mono_component<C>(
&self
) -> Result<Option<C>, DeserializationError>where
C: Component,
Get a single optional mono-component.
sourcepub fn from_components(
data_time: Option<TimeInt>,
primary_row_id: RowId,
components: impl IntoIterator<Item = ComponentWithInstances>
) -> ArchetypeView<A>
pub fn from_components( data_time: Option<TimeInt>, primary_row_id: RowId, components: impl IntoIterator<Item = ComponentWithInstances> ) -> ArchetypeView<A>
Helper function to produce an ArchetypeView
from a collection of ComponentWithInstances
.
sourcepub fn to_archetype(&self) -> Result<A, QueryError>
pub fn to_archetype(&self) -> Result<A, QueryError>
Convert an ArchetypeView
back into a native Archetype instance
sourcepub fn to_data_cell_row_1<'a, C1>(&self) -> Result<DataCellRow, QueryError>
pub fn to_data_cell_row_1<'a, C1>(&self) -> Result<DataCellRow, QueryError>
Useful for tests.
sourcepub fn to_data_cell_row_2<'a, C1, C2>(&self) -> Result<DataCellRow, QueryError>
pub fn to_data_cell_row_2<'a, C1, C2>(&self) -> Result<DataCellRow, QueryError>
Useful for tests.
Trait Implementations§
source§impl<A> Clone for ArchetypeView<A>
impl<A> 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 moresource§impl<A> Debug for ArchetypeView<A>
impl<A> Debug for ArchetypeView<A>
Auto Trait Implementations§
impl<A> Freeze for ArchetypeView<A>
impl<A> !RefUnwindSafe for ArchetypeView<A>
impl<A> Send for ArchetypeView<A>where
A: Send,
impl<A> Sync for ArchetypeView<A>where
A: Sync,
impl<A> Unpin for ArchetypeView<A>where
A: Unpin,
impl<A> !UnwindSafe for ArchetypeView<A>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.