Struct Config
pub struct Config { /* private fields */ }
Available on crate feature
peer-store
only.Expand description
Config for MemoryStore
. The available options are documented via their setters.
Implementations§
§impl Config
impl Config
pub fn record_capacity(&self) -> &NonZero<usize>
pub fn set_record_capacity(self, capacity: NonZero<usize>) -> Config
pub fn set_record_capacity(self, capacity: NonZero<usize>) -> Config
The capacity of an address store.
The least active address will be discarded to make room for new address.
8
by default.
pub fn is_remove_addr_on_dial_error(&self) -> bool
pub fn set_remove_addr_on_dial_error(self, value: bool) -> Config
pub fn set_remove_addr_on_dial_error(self, value: bool) -> Config
If set to true
, the store will remove addresses if the swarm indicates a dial failure.
More specifically:
- Failed dials indicated in
ConnectionEstablished
’sfailed_addresses
will be removed. DialError::LocalPeerId
causes the full peer entry to be removed.- On
DialError::WrongPeerId
, the address will be removed from the incorrect peer’s record and re-added to the correct peer’s record. - On
DialError::Transport
, all failed addresses will be removed.
If set to false
, the logic above is not applied and the store only removes addresses
through calls to MemoryStore::remove_address
.
true
by default.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more