re_types/components/
text_log_level.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/text_log_level.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**: The severity level of a text log message.
23///
24/// Recommended to be one of:
25/// * `"CRITICAL"`
26/// * `"ERROR"`
27/// * `"WARN"`
28/// * `"INFO"`
29/// * `"DEBUG"`
30/// * `"TRACE"`
31#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
32#[repr(transparent)]
33pub struct TextLogLevel(pub crate::datatypes::Utf8);
34
35impl ::re_types_core::Component for TextLogLevel {
36    #[inline]
37    fn name() -> ComponentType {
38        "rerun.components.TextLogLevel".into()
39    }
40}
41
42::re_types_core::macros::impl_into_cow!(TextLogLevel);
43
44impl ::re_types_core::Loggable for TextLogLevel {
45    #[inline]
46    fn arrow_datatype() -> arrow::datatypes::DataType {
47        crate::datatypes::Utf8::arrow_datatype()
48    }
49
50    fn to_arrow_opt<'a>(
51        data: impl IntoIterator<Item = Option<impl Into<::std::borrow::Cow<'a, Self>>>>,
52    ) -> SerializationResult<arrow::array::ArrayRef>
53    where
54        Self: Clone + 'a,
55    {
56        crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| {
57            datum.map(|datum| match datum.into() {
58                ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0),
59                ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0),
60            })
61        }))
62    }
63
64    fn from_arrow_opt(
65        arrow_data: &dyn arrow::array::Array,
66    ) -> DeserializationResult<Vec<Option<Self>>>
67    where
68        Self: Sized,
69    {
70        crate::datatypes::Utf8::from_arrow_opt(arrow_data)
71            .map(|v| v.into_iter().map(|v| v.map(Self)).collect())
72    }
73}
74
75impl<T: Into<crate::datatypes::Utf8>> From<T> for TextLogLevel {
76    fn from(v: T) -> Self {
77        Self(v.into())
78    }
79}
80
81impl std::borrow::Borrow<crate::datatypes::Utf8> for TextLogLevel {
82    #[inline]
83    fn borrow(&self) -> &crate::datatypes::Utf8 {
84        &self.0
85    }
86}
87
88impl std::ops::Deref for TextLogLevel {
89    type Target = crate::datatypes::Utf8;
90
91    #[inline]
92    fn deref(&self) -> &crate::datatypes::Utf8 {
93        &self.0
94    }
95}
96
97impl std::ops::DerefMut for TextLogLevel {
98    #[inline]
99    fn deref_mut(&mut self) -> &mut crate::datatypes::Utf8 {
100        &mut self.0
101    }
102}
103
104impl ::re_byte_size::SizeBytes for TextLogLevel {
105    #[inline]
106    fn heap_size_bytes(&self) -> u64 {
107        self.0.heap_size_bytes()
108    }
109
110    #[inline]
111    fn is_pod() -> bool {
112        <crate::datatypes::Utf8>::is_pod()
113    }
114}