pub enum MemoryLimitsConfig {
Disabled,
Percentage {
value: f64,
},
Mb {
value: usize,
},
}Expand description
The network configuration. Memory-based connection limit policy.
Controls when libp2p should stop accepting new connections based on
process memory usage. The default is Disabled.
§Config examples
# Reject new connections when process RAM exceeds 80% of system RAM (value must be 0.0–1.0)
[network.memory_limits]
type = "percentage"
value = 0.8
# Reject new connections when process RAM exceeds 512 MB
[network.memory_limits]
type = "mb"
value = 512
# No memory-based limit (default — omit the section or set type = "disabled")Variants§
Disabled
No memory-based connection limit (default).
Percentage
Reject new connections when process memory exceeds value fraction of total RAM.
Must be in the range 0.0–1.0 (e.g. 0.8 means 80% of system RAM).
Mb
Reject new connections when process memory exceeds value megabytes.
Implementations§
Trait Implementations§
Source§impl Clone for MemoryLimitsConfig
impl Clone for MemoryLimitsConfig
Source§fn clone(&self) -> MemoryLimitsConfig
fn clone(&self) -> MemoryLimitsConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryLimitsConfig
impl Debug for MemoryLimitsConfig
Source§impl Default for MemoryLimitsConfig
impl Default for MemoryLimitsConfig
Source§fn default() -> MemoryLimitsConfig
fn default() -> MemoryLimitsConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for MemoryLimitsConfig
impl<'de> Deserialize<'de> for MemoryLimitsConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for MemoryLimitsConfig
impl Display for MemoryLimitsConfig
Source§impl PartialEq for MemoryLimitsConfig
impl PartialEq for MemoryLimitsConfig
Source§impl Serialize for MemoryLimitsConfig
impl Serialize for MemoryLimitsConfig
impl StructuralPartialEq for MemoryLimitsConfig
Auto Trait Implementations§
impl Freeze for MemoryLimitsConfig
impl RefUnwindSafe for MemoryLimitsConfig
impl Send for MemoryLimitsConfig
impl Sync for MemoryLimitsConfig
impl Unpin for MemoryLimitsConfig
impl UnsafeUnpin for MemoryLimitsConfig
impl UnwindSafe for MemoryLimitsConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.