re_types/components/
video_timestamp.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/video_timestamp.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**: Timestamp inside a [`archetypes::AssetVideo`][crate::archetypes::AssetVideo].
23#[derive(Clone, Debug, Copy, PartialEq, Eq, Default)]
24#[repr(transparent)]
25pub struct VideoTimestamp(pub crate::datatypes::VideoTimestamp);
26
27impl ::re_types_core::Component for VideoTimestamp {
28    #[inline]
29    fn name() -> ComponentType {
30        "rerun.components.VideoTimestamp".into()
31    }
32}
33
34::re_types_core::macros::impl_into_cow!(VideoTimestamp);
35
36impl ::re_types_core::Loggable for VideoTimestamp {
37    #[inline]
38    fn arrow_datatype() -> arrow::datatypes::DataType {
39        crate::datatypes::VideoTimestamp::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::VideoTimestamp::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::VideoTimestamp::from_arrow_opt(arrow_data)
63            .map(|v| v.into_iter().map(|v| v.map(Self)).collect())
64    }
65
66    #[inline]
67    fn from_arrow(arrow_data: &dyn arrow::array::Array) -> DeserializationResult<Vec<Self>>
68    where
69        Self: Sized,
70    {
71        crate::datatypes::VideoTimestamp::from_arrow(arrow_data)
72            .map(|v| v.into_iter().map(Self).collect())
73    }
74}
75
76impl<T: Into<crate::datatypes::VideoTimestamp>> From<T> for VideoTimestamp {
77    fn from(v: T) -> Self {
78        Self(v.into())
79    }
80}
81
82impl std::borrow::Borrow<crate::datatypes::VideoTimestamp> for VideoTimestamp {
83    #[inline]
84    fn borrow(&self) -> &crate::datatypes::VideoTimestamp {
85        &self.0
86    }
87}
88
89impl std::ops::Deref for VideoTimestamp {
90    type Target = crate::datatypes::VideoTimestamp;
91
92    #[inline]
93    fn deref(&self) -> &crate::datatypes::VideoTimestamp {
94        &self.0
95    }
96}
97
98impl std::ops::DerefMut for VideoTimestamp {
99    #[inline]
100    fn deref_mut(&mut self) -> &mut crate::datatypes::VideoTimestamp {
101        &mut self.0
102    }
103}
104
105impl ::re_byte_size::SizeBytes for VideoTimestamp {
106    #[inline]
107    fn heap_size_bytes(&self) -> u64 {
108        self.0.heap_size_bytes()
109    }
110
111    #[inline]
112    fn is_pod() -> bool {
113        <crate::datatypes::VideoTimestamp>::is_pod()
114    }
115}