[][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
) -> Self where
    TMuxer: StreamMuxer + Send + Sync + 'static,
    TMuxer::OutboundSubstream: Send + 'static,
    <TMuxer as StreamMuxer>::OutboundSubstream: Send + 'static,
    <TMuxer as StreamMuxer>::Substream: Send + 'static,
    TTransport: Transport<Output = (TConnInfo, TMuxer)> + Clone + Send + Sync + 'static,
    TTransport::Error: Send + Sync + 'static,
    TTransport::Listener: Send + 'static,
    TTransport::ListenerUpgrade: Send + 'static,
    TTransport::Dial: Send + 'static, 
[src]

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

pub fn executor(self, executor: impl Executor + Send + 'static) -> Self[src]

Sets the executor to use to spawn background tasks.

By default, uses a threads pool.

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

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

pub fn build(self) -> Swarm<TBehaviour, 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>,