|
1 | 1 | use std::collections::{BTreeMap, BTreeSet};
|
2 | 2 |
|
3 | 3 | use re_protos::{missing_field, TypeConversionError};
|
4 |
| - |
5 |
| -impl TryFrom<re_protos::common::v1alpha1::ComponentColumnSelector> |
6 |
| - for crate::ComponentColumnSelector |
7 |
| -{ |
8 |
| - type Error = TypeConversionError; |
9 |
| - |
10 |
| - fn try_from( |
11 |
| - value: re_protos::common::v1alpha1::ComponentColumnSelector, |
12 |
| - ) -> Result<Self, Self::Error> { |
13 |
| - let entity_path = value |
14 |
| - .entity_path |
15 |
| - .ok_or(missing_field!( |
16 |
| - re_protos::common::v1alpha1::ComponentColumnSelector, |
17 |
| - "entity_path", |
18 |
| - ))? |
19 |
| - .try_into()?; |
20 |
| - |
21 |
| - let component_name = value |
22 |
| - .component |
23 |
| - .ok_or(missing_field!( |
24 |
| - re_protos::common::v1alpha1::ComponentColumnSelector, |
25 |
| - "component", |
26 |
| - ))? |
27 |
| - .name; |
28 |
| - |
29 |
| - Ok(Self { |
30 |
| - entity_path, |
31 |
| - component_name, |
32 |
| - }) |
33 |
| - } |
34 |
| -} |
35 |
| - |
36 |
| -impl TryFrom<re_protos::common::v1alpha1::TimeColumnSelector> for crate::TimeColumnSelector { |
37 |
| - type Error = TypeConversionError; |
38 |
| - |
39 |
| - fn try_from( |
40 |
| - value: re_protos::common::v1alpha1::TimeColumnSelector, |
41 |
| - ) -> Result<Self, Self::Error> { |
42 |
| - let timeline = value.timeline.ok_or(missing_field!( |
43 |
| - re_protos::common::v1alpha1::TimeColumnSelector, |
44 |
| - "timeline", |
45 |
| - ))?; |
46 |
| - |
47 |
| - Ok(Self { |
48 |
| - timeline: timeline.name.into(), |
49 |
| - }) |
50 |
| - } |
51 |
| -} |
52 |
| - |
53 |
| -impl TryFrom<re_protos::common::v1alpha1::ColumnSelector> for crate::ColumnSelector { |
54 |
| - type Error = TypeConversionError; |
55 |
| - |
56 |
| - fn try_from(value: re_protos::common::v1alpha1::ColumnSelector) -> Result<Self, Self::Error> { |
57 |
| - match value.selector_type.ok_or(missing_field!( |
58 |
| - re_protos::common::v1alpha1::ColumnSelector, |
59 |
| - "selector_type", |
60 |
| - ))? { |
61 |
| - re_protos::common::v1alpha1::column_selector::SelectorType::ComponentColumn( |
62 |
| - component_column_selector, |
63 |
| - ) => { |
64 |
| - let selector: crate::ComponentColumnSelector = |
65 |
| - component_column_selector.try_into()?; |
66 |
| - Ok(selector.into()) |
67 |
| - } |
68 |
| - re_protos::common::v1alpha1::column_selector::SelectorType::TimeColumn( |
69 |
| - time_column_selector, |
70 |
| - ) => { |
71 |
| - let selector: crate::TimeColumnSelector = time_column_selector.try_into()?; |
72 |
| - |
73 |
| - Ok(selector.into()) |
74 |
| - } |
75 |
| - } |
76 |
| - } |
77 |
| -} |
78 |
| - |
79 |
| -impl From<crate::ColumnSelector> for re_protos::common::v1alpha1::ColumnSelector { |
80 |
| - fn from(value: crate::ColumnSelector) -> Self { |
81 |
| - match value { |
82 |
| - crate::ColumnSelector::Component(ccs) => Self { |
83 |
| - selector_type: Some( |
84 |
| - re_protos::common::v1alpha1::column_selector::SelectorType::ComponentColumn( |
85 |
| - re_protos::common::v1alpha1::ComponentColumnSelector { |
86 |
| - entity_path: Some(ccs.entity_path.into()), |
87 |
| - component: Some(re_protos::common::v1alpha1::Component { |
88 |
| - name: ccs.component_name, |
89 |
| - }), |
90 |
| - }, |
91 |
| - ), |
92 |
| - ), |
93 |
| - }, |
94 |
| - crate::ColumnSelector::Time(tcs) => Self { |
95 |
| - selector_type: Some( |
96 |
| - re_protos::common::v1alpha1::column_selector::SelectorType::TimeColumn( |
97 |
| - re_protos::common::v1alpha1::TimeColumnSelector { |
98 |
| - timeline: Some(re_protos::common::v1alpha1::Timeline { |
99 |
| - name: tcs.timeline.to_string(), |
100 |
| - }), |
101 |
| - }, |
102 |
| - ), |
103 |
| - ), |
104 |
| - }, |
105 |
| - } |
106 |
| - } |
107 |
| -} |
| 4 | +use re_sorbet::{ColumnSelector, ComponentColumnSelector}; |
108 | 5 |
|
109 | 6 | impl TryFrom<re_protos::common::v1alpha1::ViewContents> for crate::ViewContentsSelector {
|
110 | 7 | type Error = TypeConversionError;
|
@@ -151,14 +48,14 @@ impl TryFrom<re_protos::common::v1alpha1::Query> for crate::QueryExpression {
|
151 | 48 | .map(|cs| {
|
152 | 49 | cs.columns
|
153 | 50 | .into_iter()
|
154 |
| - .map(crate::ColumnSelector::try_from) |
| 51 | + .map(ColumnSelector::try_from) |
155 | 52 | .collect::<Result<Vec<_>, _>>()
|
156 | 53 | })
|
157 | 54 | .transpose()?;
|
158 | 55 |
|
159 | 56 | let filtered_is_not_null = value
|
160 | 57 | .filtered_is_not_null
|
161 |
| - .map(crate::ComponentColumnSelector::try_from) |
| 58 | + .map(ComponentColumnSelector::try_from) |
162 | 59 | .transpose()?;
|
163 | 60 |
|
164 | 61 | Ok(Self {
|
|
0 commit comments