1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use arrow2_convert::{ArrowDeserialize, ArrowField, ArrowSerialize};
/// A text entry component, comprised of a text body and its log level.
///
/// ```
/// use re_components::TextEntry;
/// use arrow2_convert::field::ArrowField;
/// use arrow2::datatypes::{DataType, Field};
///
/// assert_eq!(
/// TextEntry::data_type(),
/// DataType::Struct(vec![
/// Field::new("body", DataType::Utf8, false),
/// Field::new("level", DataType::Utf8, true),
/// ])
/// );
/// ```
#[derive(Clone, Debug, ArrowField, ArrowSerialize, ArrowDeserialize, PartialEq, Eq)]
pub struct TextEntry {
pub body: String,
// Recommended to be one of:
// * `"CRITICAL"`
// * `"ERROR"`
// * `"WARN"`
// * `"INFO"`
// * `"DEBUG"`
// * `"TRACE"`
pub level: Option<String>,
}
impl TextEntry {
#[inline]
pub fn new(body: impl Into<String>, level: Option<String>) -> Self {
Self {
body: body.into(),
level,
}
}
#[inline]
pub fn from_body(body: impl Into<String>) -> Self {
Self {
body: body.into(),
level: None,
}
}
}
impl re_log_types::LegacyComponent for TextEntry {
#[inline]
fn legacy_name() -> re_log_types::ComponentName {
"rerun.text_entry".into()
}
}
re_log_types::component_legacy_shim!(TextEntry);