fn new_with_data<REv>(
        event_queue: EventQueueHandle<REv>,
        node_id: NodeId,
        nodes: Network<P>,
    ) -> Self
    where
        REv: From<NetworkAnnouncement<NodeId, P>> + Send,
    {
        let (sender, receiver) = mpsc::unbounded_channel();

        // Sanity check, ensure that we do not create duplicate nodes.
        {
            let mut nodes_write = nodes.write().expect("network lock poisoned");
            assert!(!nodes_write.contains_key(&node_id));
            nodes_write.insert(node_id, sender);
        }

        tokio::spawn(receiver_task(event_queue, receiver));

        InMemoryNetwork { node_id, nodes }
    }
/// Creates a new in-memory network node.
Creates a new in-memory network node.
Creates a new in - memory network node .
fn new_with_data<REv>(
        event_queue: EventQueueHandle<REv>,
        node_id: NodeId,
        nodes: Network<P>,
    ) -> Self
    where
        REv: From<NetworkAnnouncement<NodeId, P>> + Send,
    {
        let (sender, receiver) = mpsc::unbounded_channel();
        // Sanity check, ensure that we do not create duplicate nodes.
        {
            let mut nodes_write = nodes.write().expect("network lock poisoned");
            assert!(!nodes_write.contains_key(&node_id));
            nodes_write.insert(node_id, sender);
        }
        tokio::spawn(receiver_task(event_queue, receiver));
        InMemoryNetwork { node_id, nodes }
    }
fn new_with_data < REv > ( event_queue : EventQueueHandle < REv > , node_id : NodeId , nodes : Network < P > , ) -> Self where REv : From < NetworkAnnouncement < NodeId , P > > + Send , { let ( sender , receiver ) = mpsc :: unbounded_channel ( ) ; // Sanity check, ensure that we do not create duplicate nodes. { let mut nodes_write = nodes . write ( ) . expect ( " " ) ; assert ! ( nodes_write contains_key ( node_id ) ) ; nodes_write . insert ( node_id , sender ) ; } tokio :: spawn ( receiver_task ( event_queue , receiver ) ) ; InMemoryNetwork { node_id , nodes } }
Creates a new in-memory network node.
Creates a new in - memory network node .
event_queue
EventQueueHandle<REv>
node_id
NodeId
nodes
Network<P>
event_queue
EventQueueHandle<REv>
node_id
NodeId
nodes
Network<P>