[][src]Struct libp2p::swarm::SwarmBuilder

pub struct SwarmBuilder<TBehaviour, TConnInfo> { /* fields omitted */ }

Methods

impl<TBehaviour, TConnInfo> SwarmBuilder<TBehaviour, TConnInfo> where
    TBehaviour: NetworkBehaviour,
    TConnInfo: ConnectionInfo<PeerId = PeerId> + Debug + Clone + Send + 'static, 
[src]

pub fn new<TTransport, TMuxer>(
    transport: TTransport,
    behaviour: TBehaviour,
    local_peer_id: PeerId
) -> SwarmBuilder<TBehaviour, TConnInfo> where
    TMuxer: StreamMuxer + Send + Sync + 'static,
    TTransport: Transport<Output = (TConnInfo, TMuxer)> + Clone + Send + Sync + 'static,
    <TMuxer as StreamMuxer>::OutboundSubstream: Send,
    <TMuxer as StreamMuxer>::OutboundSubstream: 'static,
    <TMuxer as StreamMuxer>::OutboundSubstream: Send,
    <TMuxer as StreamMuxer>::OutboundSubstream: 'static,
    <TMuxer as StreamMuxer>::Substream: Send,
    <TMuxer as StreamMuxer>::Substream: 'static,
    <TTransport as Transport>::Error: Send,
    <TTransport as Transport>::Error: Sync,
    <TTransport as Transport>::Error: 'static,
    <TTransport as Transport>::Listener: Send,
    <TTransport as Transport>::Listener: 'static,
    <TTransport as Transport>::ListenerUpgrade: Send,
    <TTransport as Transport>::ListenerUpgrade: 'static,
    <TTransport as Transport>::Dial: Send,
    <TTransport as Transport>::Dial: 'static, 
[src]

pub fn incoming_limit(
    self,
    incoming_limit: Option<u32>
) -> SwarmBuilder<TBehaviour, TConnInfo>
[src]

pub fn executor(
    self,
    executor: impl Send + Executor + 'static
) -> SwarmBuilder<TBehaviour, TConnInfo>
[src]

Sets the executor to use to spawn background tasks.

By default, uses a threads pool.

pub fn executor_fn(
    self,
    executor: impl Send + Fn(Pin<Box<dyn Future<Output = ()> + 'static + Send>>) + 'static
) -> SwarmBuilder<TBehaviour, TConnInfo>
[src]

Shortcut for calling executor with an object that calls the given closure.

pub fn build(
    self
) -> ExpandedSwarm<TBehaviour, <<<TBehaviour as NetworkBehaviour>::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::InEvent, <<<TBehaviour as NetworkBehaviour>::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::OutEvent, <TBehaviour as NetworkBehaviour>::ProtocolsHandler, <<<TBehaviour as NetworkBehaviour>::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::Error, TConnInfo>
[src]

Auto Trait Implementations

impl<TBehaviour, TConnInfo> !RefUnwindSafe for SwarmBuilder<TBehaviour, TConnInfo>

impl<TBehaviour, TConnInfo> Send for SwarmBuilder<TBehaviour, TConnInfo> where
    TBehaviour: Send

impl<TBehaviour, TConnInfo> !Sync for SwarmBuilder<TBehaviour, TConnInfo>

impl<TBehaviour, TConnInfo> Unpin for SwarmBuilder<TBehaviour, TConnInfo> where
    TBehaviour: Unpin

impl<TBehaviour, TConnInfo> !UnwindSafe for SwarmBuilder<TBehaviour, TConnInfo>

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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<V, T> VZip<V> for T where
    V: MultiLane<T>,