re_types/components/
graph_edge.rs

1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs
2// Based on "crates/store/re_types/definitions/rerun/components/graph_edge.fbs".
3
4#![allow(unused_braces)]
5#![allow(unused_imports)]
6#![allow(unused_parens)]
7#![allow(clippy::clone_on_copy)]
8#![allow(clippy::cloned_instead_of_copied)]
9#![allow(clippy::map_flatten)]
10#![allow(clippy::needless_question_mark)]
11#![allow(clippy::new_without_default)]
12#![allow(clippy::redundant_closure)]
13#![allow(clippy::too_many_arguments)]
14#![allow(clippy::too_many_lines)]
15
16use ::re_types_core::try_serialize_field;
17use ::re_types_core::SerializationResult;
18use ::re_types_core::{ComponentBatch as _, SerializedComponentBatch};
19use ::re_types_core::{ComponentDescriptor, ComponentType};
20use ::re_types_core::{DeserializationError, DeserializationResult};
21
22/// **Component**: An edge in a graph connecting two nodes.
23#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
24#[repr(transparent)]
25pub struct GraphEdge(pub crate::datatypes::Utf8Pair);
26
27impl ::re_types_core::Component for GraphEdge {
28    #[inline]
29    fn name() -> ComponentType {
30        "rerun.components.GraphEdge".into()
31    }
32}
33
34::re_types_core::macros::impl_into_cow!(GraphEdge);
35
36impl ::re_types_core::Loggable for GraphEdge {
37    #[inline]
38    fn arrow_datatype() -> arrow::datatypes::DataType {
39        crate::datatypes::Utf8Pair::arrow_datatype()
40    }
41
42    fn to_arrow_opt<'a>(
43        data: impl IntoIterator<Item = Option<impl Into<::std::borrow::Cow<'a, Self>>>>,
44    ) -> SerializationResult<arrow::array::ArrayRef>
45    where
46        Self: Clone + 'a,
47    {
48        crate::datatypes::Utf8Pair::to_arrow_opt(data.into_iter().map(|datum| {
49            datum.map(|datum| match datum.into() {
50                ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0),
51                ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0),
52            })
53        }))
54    }
55
56    fn from_arrow_opt(
57        arrow_data: &dyn arrow::array::Array,
58    ) -> DeserializationResult<Vec<Option<Self>>>
59    where
60        Self: Sized,
61    {
62        crate::datatypes::Utf8Pair::from_arrow_opt(arrow_data)
63            .map(|v| v.into_iter().map(|v| v.map(Self)).collect())
64    }
65}
66
67impl<T: Into<crate::datatypes::Utf8Pair>> From<T> for GraphEdge {
68    fn from(v: T) -> Self {
69        Self(v.into())
70    }
71}
72
73impl std::borrow::Borrow<crate::datatypes::Utf8Pair> for GraphEdge {
74    #[inline]
75    fn borrow(&self) -> &crate::datatypes::Utf8Pair {
76        &self.0
77    }
78}
79
80impl std::ops::Deref for GraphEdge {
81    type Target = crate::datatypes::Utf8Pair;
82
83    #[inline]
84    fn deref(&self) -> &crate::datatypes::Utf8Pair {
85        &self.0
86    }
87}
88
89impl std::ops::DerefMut for GraphEdge {
90    #[inline]
91    fn deref_mut(&mut self) -> &mut crate::datatypes::Utf8Pair {
92        &mut self.0
93    }
94}
95
96impl ::re_byte_size::SizeBytes for GraphEdge {
97    #[inline]
98    fn heap_size_bytes(&self) -> u64 {
99        self.0.heap_size_bytes()
100    }
101
102    #[inline]
103    fn is_pod() -> bool {
104        <crate::datatypes::Utf8Pair>::is_pod()
105    }
106}