[][src]Struct libp2p::core::network::NetworkConfig

pub struct NetworkConfig { /* fields omitted */ }

The (optional) configuration for a [Network].

The default configuration specifies no dedicated task executor, no connection limits, a connection event buffer size of 32, and a notify_handler buffer size of 8.

Implementations

impl NetworkConfig[src]

pub fn set_executor(
    &mut self,
    e: Box<dyn Executor + 'static + Send>
) -> &mut NetworkConfig
[src]

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

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

pub fn executor(&self) -> Option<&Box<dyn Executor + 'static + Send>>[src]

pub fn set_notify_handler_buffer_size(
    &mut self,
    n: NonZeroUsize
) -> &mut NetworkConfig
[src]

Sets the maximum number of events sent to a connection's background task that may be buffered, if the task cannot keep up with their consumption and delivery to the connection handler.

When the buffer for a particular connection is full, notify_handler will no longer be able to deliver events to the associated ConnectionHandler, thus exerting back-pressure on the connection and peer API.

pub fn set_connection_event_buffer_size(
    &mut self,
    n: usize
) -> &mut NetworkConfig
[src]

Sets the maximum number of buffered connection events (beyond a guaranteed buffer of 1 event per connection).

When the buffer is full, the background tasks of all connections will stall. In this way, the consumers of network events exert back-pressure on the network connection I/O.

pub fn set_incoming_limit(&mut self, n: usize) -> &mut NetworkConfig[src]

pub fn set_outgoing_limit(&mut self, n: usize) -> &mut NetworkConfig[src]

pub fn set_established_per_peer_limit(&mut self, n: usize) -> &mut NetworkConfig[src]

pub fn set_outgoing_per_peer_limit(&mut self, n: usize) -> &mut NetworkConfig[src]

Trait Implementations

impl Default for NetworkConfig[src]

Auto Trait Implementations

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> Clear for T where
    T: InitializableFromZeroed + ?Sized

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

impl<T> InitializableFromZeroed for T where
    T: Default

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>,