p2p/
p2p_effects.rs

1use crate::{connection::P2pConnectionEffectfulAction, P2pEffectfulAction, P2pStore};
2use redux::ActionMeta;
3
4impl P2pEffectfulAction {
5    pub fn effects<Store, S>(self, meta: ActionMeta, store: &mut Store)
6    where
7        Store: P2pStore<S>,
8        Store::Service: crate::P2pService,
9    {
10        match self {
11            P2pEffectfulAction::Initialize => {}
12            P2pEffectfulAction::Channels(action) => action.effects(&meta, store),
13            P2pEffectfulAction::Connection(action) => match action {
14                P2pConnectionEffectfulAction::Outgoing(action) => action.effects(&meta, store),
15                P2pConnectionEffectfulAction::Incoming(action) => action.effects(&meta, store),
16            },
17            P2pEffectfulAction::Disconnection(action) => action.effects(&meta, store),
18            #[cfg(feature = "p2p-libp2p")]
19            P2pEffectfulAction::Network(action) => action.effects(&meta, store),
20            #[cfg(not(feature = "p2p-libp2p"))]
21            P2pEffectfulAction::Network(action) => {}
22        }
23    }
24}