fn collect_frames(&mut self) {
            let all_frames: Vec<(ContextId, Vec<(SendMeta, Vec<u8>)>)> = self
                .contexts
                .iter_mut()
                .filter_map(|(n, ctx)| {
                    if ctx.frames.frames.is_empty() {
                        None
                    } else {
                        Some((n.clone(), ctx.frames.frames.drain(..).collect()))
                    }
                })
                .collect();

            for (src_context, frames) in all_frames.into_iter() {
                for (send_meta, frame) in frames.into_iter() {
                    for (dst_context, dst_device, recv_meta, latency) in self.links.map_link(
                        src_context,
                        self.contexts.get(&src_context).unwrap().get_ref(),
                        send_meta,
                    ) {
                        self.pending_frames.push(PendingFrame::new(
                            self.current_time + latency.unwrap_or(Duration::from_millis(0)),
                            PendingFrameData {
                                frame: frame.clone(),
                                dst_context,
                                dst_device,
                                meta: recv_meta,
                            },
                        ));
                    }
                }
            }
        }
/// Collects all queued frames.
///
/// Collects all pending frames and schedules them for delivery to the
/// destination context/device based on the result of `links`. The
/// collected frames are queued for dispatching in the `DummyNetwork`,
/// ordered by their scheduled delivery time given by the latency result
/// provided by `links`.
Collects all queued frames.
Collects all pending frames and schedules them for delivery to the
destination context/device based on the result of `links`. The
collected frames are queued for dispatching in the `DummyNetwork`,
ordered by their scheduled delivery time given by the latency result
provided by `links`.
Collects all queued frames . Collects all pending frames and schedules them for delivery to the destination context / device based on the result of ` links ` . The collected frames are queued for dispatching in the ` DummyNetwork ` ordered by their scheduled delivery time given by the latency result provided by ` links ` .
fn collect_frames(&mut self) {
            let all_frames: Vec<(ContextId, Vec<(SendMeta, Vec<u8>)>)> = self
                .contexts
                .iter_mut()
                .filter_map(|(n, ctx)| {
                    if ctx.frames.frames.is_empty() {
                        None
                    } else {
                        Some((n.clone(), ctx.frames.frames.drain(..).collect()))
                    }
                })
                .collect();
            for (src_context, frames) in all_frames.into_iter() {
                for (send_meta, frame) in frames.into_iter() {
                    for (dst_context, dst_device, recv_meta, latency) in self.links.map_link(
                        src_context,
                        self.contexts.get(&src_context).unwrap().get_ref(),
                        send_meta,
                    ) {
                        self.pending_frames.push(PendingFrame::new(
                            self.current_time + latency.unwrap_or(Duration::from_millis(0)),
                            PendingFrameData {
                                frame: frame.clone(),
                                dst_context,
                                dst_device,
                                meta: recv_meta,
                            },
                        ));
                    }
                }
            }
        }
fn collect_frames ( & mut self ) { let all_frames : Vec < ( ContextId , Vec < ( SendMeta , Vec < u8 > ) > ) > = self . contexts . iter_mut ( ) . filter_map ( | ( n , ctx ) | { if ctx . frames . frames . is_empty ( ) { None } else { Some ( ( n . clone ( ) , ctx . frames . frames . drain ( .. ) . collect ( ) ) ) } } ) . collect ( ) ; for ( src_context , frames ) in all_frames . into_iter ( ) { for ( send_meta , frame ) in frames . into_iter ( ) { for ( dst_context , dst_device , recv_meta , latency ) in self . links . map_link ( src_context , self . contexts . get ( & src_context ) . unwrap ( ) . get_ref ( ) , send_meta , ) { self . pending_frames . push ( PendingFrame :: new ( self . current_time + latency . unwrap_or ( Duration :: from_millis ( 0 ) ) , PendingFrameData { frame : frame . clone ( ) , dst_context , dst_device , meta : recv_meta , } , ) ) ; } } } }
Collects all queued frames.
Collects all queued frames .
&mut self
&mut self