pub fn split<LeftData: Data, RightData: Data, CN: Network<Split<LeftData, RightData>>>(
network: CN,
left_name: &'static str,
right_name: &'static str
) -> (impl NetworkExt<LeftData>, impl NetworkExt<RightData>)
Expand description
Split a single component network into two separate ones. This way multiple components can send data to the same underlying session not knowing what types of data the other ones use.
Internally the returned networks compete for data returned by their parent network when
next()
is polled, and unpack it to two separate channels. At the same time each polls
the end of those channels which contains the type that it is supposed to return.
The main example for now is creating an phron_bft::Network
and a separate one for accumulating
signatures for justifications.