standing_relations/core/op/
concat.rs1use crate::core::{relation::RelationInner, Op_, Relation};
2
3pub struct Concat<C1: Op_, C2: Op_<T = C1::T>>(RelationInner<C1>, RelationInner<C2>);
4
5impl<C1: Op_, C2: Op_<T = C1::T>> Op_ for Concat<C1, C2> {
6 type T = C1::T;
7
8 fn foreach<'a>(&'a mut self, mut continuation: impl FnMut(Self::T) + 'a) {
9 self.0.foreach(&mut continuation);
10 self.1.foreach(continuation);
11 }
12 fn get_type_name() -> &'static str {
13 "concat"
14 }
15}
16
17impl<C1: Op_> Relation<C1> {
18 pub fn concat<C2: Op_<T = C1::T>>(self, other: Relation<C2>) -> Relation<Concat<C1, C2>> {
19 assert_eq!(
20 self.context_tracker, other.context_tracker,
21 "Context mismatch"
22 );
23 self.context_tracker.add_relation(
24 self.dirty.or(other.dirty),
25 Concat(self.inner, other.inner),
26 vec![self.tracking_index, other.tracking_index],
27 )
28 }
29}