re_types/blueprint/components/
query_expression.rs1#![allow(unused_imports)]
5#![allow(unused_parens)]
6#![allow(clippy::clone_on_copy)]
7#![allow(clippy::cloned_instead_of_copied)]
8#![allow(clippy::map_flatten)]
9#![allow(clippy::needless_question_mark)]
10#![allow(clippy::new_without_default)]
11#![allow(clippy::redundant_closure)]
12#![allow(clippy::too_many_arguments)]
13#![allow(clippy::too_many_lines)]
14
15use ::re_types_core::try_serialize_field;
16use ::re_types_core::SerializationResult;
17use ::re_types_core::{ComponentBatch as _, SerializedComponentBatch};
18use ::re_types_core::{ComponentDescriptor, ComponentName};
19use ::re_types_core::{DeserializationError, DeserializationResult};
20
21#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
34#[repr(transparent)]
35pub struct QueryExpression(pub crate::datatypes::Utf8);
36
37impl ::re_types_core::Component for QueryExpression {
38 #[inline]
39 fn descriptor() -> ComponentDescriptor {
40 ComponentDescriptor::new("rerun.blueprint.components.QueryExpression")
41 }
42}
43
44::re_types_core::macros::impl_into_cow!(QueryExpression);
45
46impl ::re_types_core::Loggable for QueryExpression {
47 #[inline]
48 fn arrow_datatype() -> arrow::datatypes::DataType {
49 crate::datatypes::Utf8::arrow_datatype()
50 }
51
52 fn to_arrow_opt<'a>(
53 data: impl IntoIterator<Item = Option<impl Into<::std::borrow::Cow<'a, Self>>>>,
54 ) -> SerializationResult<arrow::array::ArrayRef>
55 where
56 Self: Clone + 'a,
57 {
58 crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| {
59 datum.map(|datum| match datum.into() {
60 ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0),
61 ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0),
62 })
63 }))
64 }
65
66 fn from_arrow_opt(
67 arrow_data: &dyn arrow::array::Array,
68 ) -> DeserializationResult<Vec<Option<Self>>>
69 where
70 Self: Sized,
71 {
72 crate::datatypes::Utf8::from_arrow_opt(arrow_data)
73 .map(|v| v.into_iter().map(|v| v.map(Self)).collect())
74 }
75}
76
77impl<T: Into<crate::datatypes::Utf8>> From<T> for QueryExpression {
78 fn from(v: T) -> Self {
79 Self(v.into())
80 }
81}
82
83impl std::borrow::Borrow<crate::datatypes::Utf8> for QueryExpression {
84 #[inline]
85 fn borrow(&self) -> &crate::datatypes::Utf8 {
86 &self.0
87 }
88}
89
90impl std::ops::Deref for QueryExpression {
91 type Target = crate::datatypes::Utf8;
92
93 #[inline]
94 fn deref(&self) -> &crate::datatypes::Utf8 {
95 &self.0
96 }
97}
98
99impl std::ops::DerefMut for QueryExpression {
100 #[inline]
101 fn deref_mut(&mut self) -> &mut crate::datatypes::Utf8 {
102 &mut self.0
103 }
104}
105
106impl ::re_byte_size::SizeBytes for QueryExpression {
107 #[inline]
108 fn heap_size_bytes(&self) -> u64 {
109 self.0.heap_size_bytes()
110 }
111
112 #[inline]
113 fn is_pod() -> bool {
114 <crate::datatypes::Utf8>::is_pod()
115 }
116}