(
&self,
nested: &mut Iterative<'b, S, u64>,
_local_arrangements: &VariableMap<Iterative<'b, S, u64>>,
context: &mut I,
)
| 341 | // @TODO make these static and take variables as well? |
| 342 | |
| 343 | fn implement_single_binding<'b, T, I, S>( |
| 344 | &self, |
| 345 | nested: &mut Iterative<'b, S, u64>, |
| 346 | _local_arrangements: &VariableMap<Iterative<'b, S, u64>>, |
| 347 | context: &mut I, |
| 348 | ) -> (Implemented<'b, S>, ShutdownHandle) |
| 349 | where |
| 350 | T: Timestamp + Lattice, |
| 351 | I: ImplContext<T>, |
| 352 | S: Scope<Timestamp = T>, |
| 353 | { |
| 354 | // With only a single binding given, we don't want to do |
| 355 | // anything fancy (provided the binding is sourceable). |
| 356 | |
| 357 | match self.bindings.first().unwrap() { |
| 358 | Binding::Attribute(binding) => { |
| 359 | match context.forward_propose(&binding.source_attribute) { |
| 360 | None => panic!("Unknown attribute {}", &binding.source_attribute), |
| 361 | Some(forward_trace) => { |
| 362 | let frontier: Vec<T> = forward_trace.advance_frontier().to_vec(); |
| 363 | let (forward, shutdown_forward) = forward_trace.import_core( |
| 364 | &nested.parent, |
| 365 | &format!("Propose({})", &binding.source_attribute), |
| 366 | ); |
| 367 | |
| 368 | let prefix = binding.variables(); |
| 369 | let target_variables = self.variables.clone(); |
| 370 | let tuples = forward |
| 371 | .enter_at(nested, move |_, _, time| { |
| 372 | let mut forwarded = time.clone(); |
| 373 | forwarded.advance_by(&frontier); |
| 374 | Product::new(forwarded, 0) |
| 375 | }) |
| 376 | .as_collection(move |e, v| { |
| 377 | let tuple = (e, v); |
| 378 | target_variables |
| 379 | .iter() |
| 380 | .flat_map(|x| { |
| 381 | Some(tuple.index(AsBinding::binds(&prefix, *x).unwrap())) |
| 382 | }) |
| 383 | .collect() |
| 384 | }); |
| 385 | |
| 386 | let relation = CollectionRelation { |
| 387 | variables: self.variables.clone(), |
| 388 | tuples, |
| 389 | }; |
| 390 | |
| 391 | ( |
| 392 | Implemented::Collection(relation), |
| 393 | ShutdownHandle::from_button(shutdown_forward), |
| 394 | ) |
| 395 | } |
| 396 | } |
| 397 | } |
| 398 | _ => { |
| 399 | panic!("Passed a single, non-sourceable binding."); |
| 400 | } |
no test coverage detected