diff --git a/crates/re_query/src/latest_at/to_archetype/background.rs b/crates/re_query/src/latest_at/to_archetype/background.rs new file mode 100644 index 000000000000..319228ffb294 --- /dev/null +++ b/crates/re_query/src/latest_at/to_archetype/background.rs @@ -0,0 +1,65 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/to_archetype.rs + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] + +use crate::{LatestAtResults, PromiseResolver, PromiseResult}; +use re_types_core::{Archetype, Loggable as _}; +use std::sync::Arc; + +impl crate::ToArchetype for LatestAtResults { + #[inline] + fn to_archetype( + &self, + resolver: &PromiseResolver, + ) -> PromiseResult> { + re_tracing::profile_function!(::name()); + + // --- Required --- + + use re_types::blueprint::components::BackgroundKind; + let kind = match self.get_required(::name()) { + Ok(kind) => kind, + Err(query_err) => return PromiseResult::Ready(Err(query_err)), + }; + let kind = match kind.to_dense::(resolver) { + PromiseResult::Pending => return PromiseResult::Pending, + PromiseResult::Error(promise_err) => return PromiseResult::Error(promise_err), + PromiseResult::Ready(query_res) => match query_res { + Ok(data) => { + let Some(first) = data.first().cloned() else { + return PromiseResult::Error(std::sync::Arc::new( + re_types_core::DeserializationError::missing_data(), + )); + }; + first + } + Err(query_err) => return PromiseResult::Ready(Err(query_err)), + }, + }; + + // --- Recommended/Optional --- + + use re_types::components::Color; + let color = if let Some(color) = self.get(::name()) { + match color.to_dense::(resolver) { + PromiseResult::Pending => return PromiseResult::Pending, + PromiseResult::Error(promise_err) => return PromiseResult::Error(promise_err), + PromiseResult::Ready(query_res) => match query_res { + Ok(data) => data.first().cloned(), + Err(query_err) => return PromiseResult::Ready(Err(query_err)), + }, + } + } else { + None + }; + + // --- + + let arch = re_types::blueprint::archetypes::Background { kind, color }; + + PromiseResult::Ready(Ok(arch)) + } +}