pub struct NetworkConfig { /* private fields */ }
Expand description
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§
Source§impl NetworkConfig
impl NetworkConfig
Sourcepub fn with_executor(self, e: Box<dyn Executor + Send>) -> Self
pub fn with_executor(self, e: Box<dyn Executor + Send>) -> Self
Configures the executor to use for spawning connection background tasks.
Sourcepub fn or_else_with_executor<F>(self, f: F) -> Self
pub fn or_else_with_executor<F>(self, f: F) -> Self
Configures the executor to use for spawning connection background tasks, only if no executor has already been configured.
Sourcepub fn with_notify_handler_buffer_size(self, n: NonZeroUsize) -> Self
pub fn with_notify_handler_buffer_size(self, n: NonZeroUsize) -> Self
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.
Sourcepub fn with_connection_event_buffer_size(self, n: usize) -> Self
pub fn with_connection_event_buffer_size(self, n: usize) -> Self
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.
Sourcepub fn with_connection_limits(self, limits: ConnectionLimits) -> Self
pub fn with_connection_limits(self, limits: ConnectionLimits) -> Self
Sets the connection limits to enforce.
Trait Implementations§
Source§impl Default for NetworkConfig
impl Default for NetworkConfig
Source§fn default() -> NetworkConfig
fn default() -> NetworkConfig
Auto Trait Implementations§
impl Freeze for NetworkConfig
impl !RefUnwindSafe for NetworkConfig
impl Send for NetworkConfig
impl !Sync for NetworkConfig
impl Unpin for NetworkConfig
impl !UnwindSafe for NetworkConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more