@@ -191,56 +191,38 @@ use rerun::external::{arrow2, re_types_core};
191
191
/// Helper to log any [`rerun::LoggableBatch`] as a [`rerun::Component`] with the specified name.
192
192
#[ derive( Debug ) ]
193
193
pub struct Aliased < C : rerun:: LoggableBatch > {
194
- name : rerun:: ComponentName ,
194
+ descriptor : rerun:: ComponentDescriptor ,
195
195
data : C ,
196
196
}
197
197
198
198
impl < C : rerun:: LoggableBatch > Aliased < C > {
199
199
pub fn new ( name : impl Into < rerun:: ComponentName > , data : impl Into < C > ) -> Self {
200
200
Self {
201
- name : name. into ( ) ,
201
+ descriptor : rerun :: ComponentDescriptor :: new ( name. into ( ) ) ,
202
202
data : data. into ( ) ,
203
203
}
204
204
}
205
205
}
206
206
207
207
impl < C : rerun:: LoggableBatch > rerun:: AsComponents for Aliased < C > {
208
208
#[ inline]
209
- fn as_component_batches ( & self ) -> Vec < rerun:: MaybeOwnedComponentBatch < ' _ > > {
210
- vec ! [ rerun:: MaybeOwnedComponentBatch :: Ref ( self ) ]
209
+ fn as_component_batches ( & self ) -> Vec < rerun:: ComponentBatchCowWithDescriptor < ' _ > > {
210
+ vec ! [ rerun:: ComponentBatchCowWithDescriptor :: new(
211
+ self as & dyn rerun:: ComponentBatch ,
212
+ ) ]
211
213
}
212
214
}
213
215
214
216
impl < C : rerun:: LoggableBatch > rerun:: LoggableBatch for Aliased < C > {
215
- type Name = rerun:: ComponentName ;
216
-
217
217
#[ inline]
218
- fn name ( & self ) -> Self :: Name {
219
- self . name
220
- }
221
-
222
- #[ inline]
223
- fn to_arrow ( & self ) -> re_types_core:: SerializationResult < Box < dyn arrow2:: array:: Array > > {
224
- self . data . to_arrow ( )
218
+ fn to_arrow2 ( & self ) -> re_types_core:: SerializationResult < Box < dyn arrow2:: array:: Array > > {
219
+ self . data . to_arrow2 ( )
225
220
}
226
221
}
227
222
228
- impl < C : rerun:: LoggableBatch > rerun:: ComponentBatch for Aliased < C > { }
229
-
230
- // ---
231
-
232
- // TODO(cmc): Rerun should provide tools for this.
233
-
234
- /// Helper to merge any number of [`rerun::AsComponents`].
235
- #[ allow( dead_code) ]
236
- pub struct ManyAsComponents ( pub Vec < Box < dyn rerun:: AsComponents > > ) ;
237
-
238
- impl rerun:: AsComponents for ManyAsComponents {
223
+ impl < C : rerun:: LoggableBatch > rerun:: ComponentBatch for Aliased < C > {
239
224
#[ inline]
240
- fn as_component_batches ( & self ) -> Vec < rerun:: MaybeOwnedComponentBatch < ' _ > > {
241
- self . 0
242
- . iter ( )
243
- . flat_map ( |data| data. as_component_batches ( ) )
244
- . collect ( )
225
+ fn descriptor ( & self ) -> std:: borrow:: Cow < ' _ , rerun:: ComponentDescriptor > {
226
+ std:: borrow:: Cow :: Borrowed ( & self . descriptor )
245
227
}
246
228
}
0 commit comments