Skip to content

Commit d7a4804

Browse files
committed
ast module
1 parent b97728d commit d7a4804

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

crates/top/re_sdk/src/lenses.rs

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -268,17 +268,27 @@ impl Op {
268268
}
269269
}
270270
}
271+
/// Private module with the AST-like definitions of lenses.
272+
///
273+
/// **Note**: We should not leak those into the public API interface,
274+
/// so that we can evolve the definition of lenses over time, if requirements
275+
/// change.
276+
mod ast {
277+
use super::{
278+
ComponentDescriptor, ComponentIdentifier, EntityPath, Op, ResolvedEntityPathFilter,
279+
};
271280

272-
struct InputColumn {
273-
entity_path_filter: ResolvedEntityPathFilter,
274-
component: ComponentIdentifier,
275-
}
281+
pub(super) struct InputColumn {
282+
pub entity_path_filter: ResolvedEntityPathFilter,
283+
pub component: ComponentIdentifier,
284+
}
276285

277-
struct OutputColumn {
278-
entity_path: EntityPath,
279-
component_descr: ComponentDescriptor,
280-
ops: Vec<Op>,
281-
is_static: bool,
286+
pub(super) struct OutputColumn {
287+
pub entity_path: EntityPath,
288+
pub component_descr: ComponentDescriptor,
289+
pub ops: Vec<Op>,
290+
pub is_static: bool,
291+
}
282292
}
283293

284294
/// Provides convenient function to create a [`Lens`].
@@ -291,7 +301,7 @@ impl LensBuilder {
291301
component: impl Into<ComponentIdentifier>,
292302
) -> Self {
293303
Self(Lens {
294-
input: InputColumn {
304+
input: ast::InputColumn {
295305
entity_path_filter: entity_path_filter.resolve_without_substitutions(),
296306
component: component.into(),
297307
},
@@ -306,7 +316,7 @@ impl LensBuilder {
306316
component_descr: ComponentDescriptor,
307317
ops: impl IntoIterator<Item = Op>,
308318
) -> Self {
309-
let column = OutputColumn {
319+
let column = ast::OutputColumn {
310320
entity_path: entity_path.into(),
311321
component_descr,
312322
ops: ops.into_iter().collect(),
@@ -323,7 +333,7 @@ impl LensBuilder {
323333
component_descr: ComponentDescriptor,
324334
ops: impl IntoIterator<Item = Op>,
325335
) -> Self {
326-
let column = OutputColumn {
336+
let column = ast::OutputColumn {
327337
entity_path: entity_path.into(),
328338
component_descr,
329339
ops: ops.into_iter().collect(),
@@ -351,8 +361,8 @@ impl LensBuilder {
351361
/// is non-deterministic, and dependent on the batcher, no assumptions should be
352362
/// made for values across rows.
353363
pub struct Lens {
354-
input: InputColumn,
355-
outputs: Vec<OutputColumn>,
364+
input: ast::InputColumn,
365+
outputs: Vec<ast::OutputColumn>,
356366
}
357367

358368
impl Lens {

0 commit comments

Comments
 (0)