[][src]Struct murmel::p2p::P2P

pub struct P2P<Message: Version + Send + Sync + Clone + 'static, Envelope: Command + Send + Sync + 'static, Config: P2PConfig<Message, Envelope> + Send + Sync + 'static> {
    pub config: Config,
    // some fields omitted
}

The P2P network layer

Fields

config: Config

Methods

impl<Message: Version + Send + Sync + Clone, Envelope: Command + Send + Sync, Config: P2PConfig<Message, Envelope> + Send + Sync> P2P<Message, Envelope, Config>[src]

pub fn new(
    config: Config,
    dispatcher: PeerMessageSender<Message>,
    back_pressure: usize
) -> (Arc<P2P<Message, Envelope, Config>>, P2PControlSender<Message>)
[src]

create a new P2P network controller

pub fn connected_peers(&self) -> Vec<SocketAddr>[src]

pub fn n_connected_peers(&self) -> usize[src]

pub fn add_peer(
    &self,
    network: &'static str,
    source: PeerSource
) -> impl Future<Output = Result<SocketAddr, Error>> + Send
[src]

return a future that does not complete until the peer is connected

pub fn poll_events(
    &self,
    network: &'static str,
    needed_services: u64,
    spawn: &mut dyn Spawn
)
[src]

run the message dispatcher loop this method does not return unless there is an error obtaining network events run in its own thread, which will process all network events

Auto Trait Implementations

impl<Message, Envelope, Config> Send for P2P<Message, Envelope, Config>

impl<Message, Envelope, Config> Unpin for P2P<Message, Envelope, Config> where
    Config: Unpin,
    Envelope: Unpin

impl<Message, Envelope, Config> Sync for P2P<Message, Envelope, Config>

impl<Message, Envelope, Config> !UnwindSafe for P2P<Message, Envelope, Config>

impl<Message, Envelope, Config> !RefUnwindSafe for P2P<Message, Envelope, Config>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,