Struct zebra_network::address_book::AddressBook
source · pub struct AddressBook {
by_addr: OrderedMap<SocketAddr, MetaAddr, Reverse<MetaAddr>>,
local_listener: SocketAddr,
network: Network,
addr_limit: usize,
span: Span,
address_metrics_tx: Sender<AddressMetrics>,
last_address_log: Option<Instant>,
}
Expand description
A database of peer listener addresses, their advertised services, and information on when they were last seen.
Security
Address book state must be based on outbound connections to peers.
If the address book is updated incorrectly:
- malicious peers can interfere with other peers’
AddressBook
state, or - Zebra can advertise unreachable addresses to its own peers.
Adding Addresses
The address book should only contain Zcash listener port addresses from peers on the configured network. These addresses can come from:
- DNS seeders
- addresses gossiped by other peers
- the canonical address (
Version.address_from
) provided by each peer, particularly peers on inbound connections.
The remote addresses of inbound connections must not be added to the address book, because they contain ephemeral outbound ports, not listener ports.
Isolated connections must not add addresses or update the address book.
Updating Address State
Updates to address state must be based on outbound connections to peers.
Updates must not be based on:
- the remote addresses of inbound connections, or
- the canonical address of any connection.
Fields§
§by_addr: OrderedMap<SocketAddr, MetaAddr, Reverse<MetaAddr>>
Peer listener addresses, suitable for outbound connections, in connection attempt order.
Some peers in this list might have open outbound or inbound connections.
We reverse the comparison order, because the standard library
(BTreeMap
) sorts in ascending order, but
[OrderedMap
] sorts in descending order.
local_listener: SocketAddr
The local listener address.
network: Network
The configured Zcash network.
addr_limit: usize
The maximum number of addresses in the address book.
Always set to MAX_ADDRS_IN_ADDRESS_BOOK
,
in release builds. Lower values are used during testing.
span: Span
The span for operations on this address book.
address_metrics_tx: Sender<AddressMetrics>
A channel used to send the latest address book metrics.
last_address_log: Option<Instant>
The last time we logged a message about the address metrics.
Implementations§
source§impl AddressBook
impl AddressBook
sourcepub fn new(
local_listener: SocketAddr,
network: Network,
span: Span
) -> AddressBook
pub fn new( local_listener: SocketAddr, network: Network, span: Span ) -> AddressBook
Construct an AddressBook
with the given local_listener
on network
.
Uses the supplied tracing::Span
for address book operations.
sourcepub fn new_with_addrs(
local_listener: SocketAddr,
network: Network,
addr_limit: usize,
span: Span,
addrs: impl IntoIterator<Item = MetaAddr>
) -> AddressBook
pub fn new_with_addrs( local_listener: SocketAddr, network: Network, addr_limit: usize, span: Span, addrs: impl IntoIterator<Item = MetaAddr> ) -> AddressBook
Construct an AddressBook
with the given local_listener
, network
,
addr_limit
, tracing::Span
, and addresses.
addr_limit
is enforced by this method, and by AddressBook::update
.
If there are multiple MetaAddr
s with the same address,
an arbitrary address is inserted into the address book,
and the rest are dropped.
This constructor can be used to break address book invariants, so it should only be used in tests.
sourcepub fn address_metrics_watcher(&self) -> Receiver<AddressMetrics>
pub fn address_metrics_watcher(&self) -> Receiver<AddressMetrics>
Return a watch channel for the address book metrics.
The metrics in the watch channel are only updated when the address book updates, so they can be significantly outdated if Zebra is disconnected or hung.
The current metrics value is marked as seen.
So Receiver::changed
will only return after the next address book update.
sourcepub fn local_listener_meta_addr(&self) -> MetaAddr
pub fn local_listener_meta_addr(&self) -> MetaAddr
Get the local listener address.
This address contains minimal state, but it is not sanitized.
sourcepub fn sanitized(&self, now: DateTime<Utc>) -> Vec<MetaAddr> ⓘ
pub fn sanitized(&self, now: DateTime<Utc>) -> Vec<MetaAddr> ⓘ
Get the contents of self
in random order with sanitized timestamps.
sourcepub fn get(&mut self, addr: &SocketAddr) -> Option<MetaAddr>
pub fn get(&mut self, addr: &SocketAddr) -> Option<MetaAddr>
Look up addr
in the address book, and return its MetaAddr
.
Converts addr
to a canonical address before looking it up.
sourcepub fn update(&mut self, change: MetaAddrChange) -> Option<MetaAddr>
pub fn update(&mut self, change: MetaAddrChange) -> Option<MetaAddr>
Apply change
to the address book, returning the updated MetaAddr
,
if the change was valid.
Correctness
All changes should go through update
, so that the address book
only contains valid outbound addresses.
Change addresses must be canonical SocketAddr
s. This makes sure that
each address book entry has a unique IP address.
Security
This function must apply every attempted, responded, and failed change to the address book. This prevents rapid reconnections to the same peer.
As an exception, this function can ignore all changes for specific
SocketAddr
s. Ignored addresses will never be used to connect to
peers.
sourcefn take(&mut self, removed_addr: SocketAddr) -> Option<MetaAddr>
fn take(&mut self, removed_addr: SocketAddr) -> Option<MetaAddr>
Removes the entry with addr
, returning it if it exists
Note
All address removals should go through take
, so that the address
book metrics are accurate.
sourcepub fn pending_reconnection_addr(&mut self, addr: &SocketAddr) -> bool
pub fn pending_reconnection_addr(&mut self, addr: &SocketAddr) -> bool
Returns true if the given SocketAddr
is pending a reconnection
attempt.
sourcepub fn peers(&self) -> impl Iterator<Item = MetaAddr> + DoubleEndedIterator + '_
pub fn peers(&self) -> impl Iterator<Item = MetaAddr> + DoubleEndedIterator + '_
Return an iterator over all peers.
Returns peers in reconnection attempt order, including recently connected peers.
sourcepub fn reconnection_peers(
&self,
instant_now: Instant,
chrono_now: DateTime<Utc>
) -> impl Iterator<Item = MetaAddr> + DoubleEndedIterator + '_
pub fn reconnection_peers( &self, instant_now: Instant, chrono_now: DateTime<Utc> ) -> impl Iterator<Item = MetaAddr> + DoubleEndedIterator + '_
Return an iterator over peers that are due for a reconnection attempt, in reconnection attempt order.
sourcepub fn state_peers(
&self,
state: PeerAddrState
) -> impl Iterator<Item = MetaAddr> + DoubleEndedIterator + '_
pub fn state_peers( &self, state: PeerAddrState ) -> impl Iterator<Item = MetaAddr> + DoubleEndedIterator + '_
Return an iterator over all the peers in state
,
in reconnection attempt order, including recently connected peers.
sourcepub fn maybe_connected_peers(
&self,
instant_now: Instant,
chrono_now: DateTime<Utc>
) -> impl Iterator<Item = MetaAddr> + DoubleEndedIterator + '_
pub fn maybe_connected_peers( &self, instant_now: Instant, chrono_now: DateTime<Utc> ) -> impl Iterator<Item = MetaAddr> + DoubleEndedIterator + '_
Return an iterator over peers that might be connected, in reconnection attempt order.
sourcefn address_metrics_internal(&self, now: DateTime<Utc>) -> AddressMetrics
fn address_metrics_internal(&self, now: DateTime<Utc>) -> AddressMetrics
Returns metrics for the addresses in this address book.
Correctness
External callers should use [AddressBook::address_metrics_watcher().borrow()
]
in production code, to avoid deadlocks.
(Using the watch channel receiver does not lock the address book mutex.)
sourcefn update_metrics(&mut self, instant_now: Instant, chrono_now: DateTime<Utc>)
fn update_metrics(&mut self, instant_now: Instant, chrono_now: DateTime<Utc>)
Update the metrics for this address book.
sourcefn log_metrics(&mut self, m: &AddressMetrics, now: Instant)
fn log_metrics(&mut self, m: &AddressMetrics, now: Instant)
Log metrics for this address book
Trait Implementations§
source§impl AddressBookPeers for AddressBook
impl AddressBookPeers for AddressBook
source§impl Clone for AddressBook
impl Clone for AddressBook
source§fn clone(&self) -> AddressBook
fn clone(&self) -> AddressBook
Clone the addresses, address limit, local listener address, and span.
Cloned address books have a separate metrics struct watch channel, and an empty last address log.
All address books update the same prometheus metrics.
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AddressBook
impl Debug for AddressBook
source§impl Extend<MetaAddrChange> for AddressBook
impl Extend<MetaAddrChange> for AddressBook
source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = MetaAddrChange>,
fn extend<T>(&mut self, iter: T)where T: IntoIterator<Item = MetaAddrChange>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Auto Trait Implementations§
impl !RefUnwindSafe for AddressBook
impl Send for AddressBook
impl Sync for AddressBook
impl Unpin for AddressBook
impl !UnwindSafe for AddressBook
Blanket Implementations§
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where &'a Self: for<'a> IntoIterator,
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> 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>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,
self
, then passes self.as_mut()
into the pipe
function.§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<Response, Error> ResponseResult<Response, Error> for Response
impl<Response, Error> ResponseResult<Response, Error> for Response
source§fn into_result(self) -> Result<Response, Error>
fn into_result(self) -> Result<Response, Error>
Result
that can be sent as a response.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds.