-
Notifications
You must be signed in to change notification settings - Fork 930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swarm: remove duplication between SwarmEvent
and FromSwarm
#4268
Comments
There is another thing we need to figure out: If we want to reuse Generally, it does seem to be a bit of a mis-match. Within |
Perhaps, what we need is to move the references from within the types like pub enum FromSwarm {
/// Informs the behaviour about a newly established connection to a peer.
ConnectionEstablished(ConnectionEstablished),
} And the signature will change to: fn on_swarm_event(&mut self, event: &FromSwarm); That is a bit annoying because it means that some data which could be owned because it is |
Description
Today,
SwarmEvent
is essentially a super-set ofFromSwarm
. This super-set is however not expressed in the type-system which leads to inconsistencies as described in #4251.We can fix this by expressing
SwarmEvent
as a composition ofFromSwarm
andToSwarm
(a type parameter that will be filled in byNetworkBehaviour::ToSwarm
.As far as I know, the only thing that is blocking this is #3046 which is "just" waiting for the next round of breaking changes.
The text was updated successfully, but these errors were encountered: