Provides data at the time specified by the capability. Flushes automatically when the capability time changes.
(&mut self, cap: &Capability<T>, data: D)
| 239 | /// Provides data at the time specified by the capability. Flushes automatically when the |
| 240 | /// capability time changes. |
| 241 | fn give<D>(&mut self, cap: &Capability<T>, data: D) |
| 242 | where |
| 243 | CB: PushInto<D>, |
| 244 | { |
| 245 | if let Some(capability) = &self.capability |
| 246 | && cap.time() != capability.time() |
| 247 | { |
| 248 | self.flush(); |
| 249 | self.capability = None; |
| 250 | } |
| 251 | if self.capability.is_none() { |
| 252 | self.capability = Some(cap.clone()); |
| 253 | } |
| 254 | |
| 255 | self.builder.push_into(data); |
| 256 | while let Some(container) = self.builder.extract() { |
| 257 | self.output |
| 258 | .give(self.capability.as_ref().expect("must exist"), container); |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | pub struct AsyncOutputHandle<T: Timestamp, CB: ContainerBuilder> { |