pub struct HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt = Drain<TicketEvent>> {
packet_key: Option<OffchainKeypair>,
chain_key: Option<ChainKeypair>,
wire_msg: (WOut, WIn),
api: (AppOut, AppIn),
surb_store: S,
chain_api: Chain,
ticket_factory: TFact,
counters: PeerProtocolCounterRegistry,
channels_dst: Option<Hash>,
cfg: HoprPacketPipelineConfig,
ticket_events: Option<TEvt>,
}Expand description
Builder for the HOPR packet pipeline.
Creates the encoder/decoder, the unacknowledged-ticket processor, optionally hooks up the
packet capture (when the capture feature is enabled) and finally delegates to the lower-level
PacketPipelineBuilder to spawn the per-stage tasks. The shape of the spawned pipeline is
selected by which terminal build_for_* method is called:
HoprPacketPipelineBuilder::build_for_relay— full pipeline. RequiresHoprPacketPipelineBuilder::with_ticket_eventsto be called beforehand.HoprPacketPipelineBuilder::build_for_entry— Entry nodes. Ticket events are not needed (and any value previously set is ignored).HoprPacketPipelineBuilder::build_for_exit— Exit nodes. Ticket events are not needed (and any value previously set is ignored).
The builder is constructed via HoprPacketPipelineBuilder::new which takes no arguments.
The required components must then be supplied via the corresponding builder methods:
identity, transport,
api, surb_store,
chain_api,
ticket_factory and
channels_dst.
The per-peer counter registry defaults to an empty one; override it via
HoprPacketPipelineBuilder::with_counters.
The configuration (HoprPacketPipelineConfig) is optional and defaults to
HoprPacketPipelineConfig::default(); override it via HoprPacketPipelineBuilder::with_config.
Fields§
§packet_key: Option<OffchainKeypair>§chain_key: Option<ChainKeypair>§wire_msg: (WOut, WIn)§api: (AppOut, AppIn)§surb_store: S§chain_api: Chain§ticket_factory: TFact§counters: PeerProtocolCounterRegistry§channels_dst: Option<Hash>§cfg: HoprPacketPipelineConfig§ticket_events: Option<TEvt>Implementations§
Source§impl HoprPacketPipelineBuilder<Unset, Unset, Unset, Unset, Unset, Unset, Unset, Drain<TicketEvent>>
impl HoprPacketPipelineBuilder<Unset, Unset, Unset, Unset, Unset, Unset, Unset, Drain<TicketEvent>>
Source§impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>
impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>
Sourcepub fn with_config(self, cfg: HoprPacketPipelineConfig) -> Self
pub fn with_config(self, cfg: HoprPacketPipelineConfig) -> Self
Overrides the default HoprPacketPipelineConfig.
Sourcepub fn with_counters(self, counters: PeerProtocolCounterRegistry) -> Self
pub fn with_counters(self, counters: PeerProtocolCounterRegistry) -> Self
Overrides the default (empty) per-peer protocol counter registry.
Sourcepub fn identity<'a, I>(self, identity: I) -> Self
pub fn identity<'a, I>(self, identity: I) -> Self
Sets the node identity (chain and offchain keypairs).
Sourcepub fn channels_dst(self, channels_dst: Hash) -> Self
pub fn channels_dst(self, channels_dst: Hash) -> Self
Sets the channel-set domain separator used by the codec and ticket processor.
Sourcepub fn transport<WIn2, WOut2>(
self,
wire_msg: (WOut2, WIn2),
) -> HoprPacketPipelineBuilder<WIn2, WOut2, Chain, S, TFact, AppOut, AppIn, TEvt>
pub fn transport<WIn2, WOut2>( self, wire_msg: (WOut2, WIn2), ) -> HoprPacketPipelineBuilder<WIn2, WOut2, Chain, S, TFact, AppOut, AppIn, TEvt>
Sets the underlying wire-message transport (outgoing sink, incoming stream).
Sourcepub fn api<AppOut2, AppIn2>(
self,
api: (AppOut2, AppIn2),
) -> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut2, AppIn2, TEvt>
pub fn api<AppOut2, AppIn2>( self, api: (AppOut2, AppIn2), ) -> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut2, AppIn2, TEvt>
Sets the application API (incoming sink, outgoing stream).
Sourcepub fn surb_store<S2>(
self,
surb_store: S2,
) -> HoprPacketPipelineBuilder<WIn, WOut, Chain, S2, TFact, AppOut, AppIn, TEvt>
pub fn surb_store<S2>( self, surb_store: S2, ) -> HoprPacketPipelineBuilder<WIn, WOut, Chain, S2, TFact, AppOut, AppIn, TEvt>
Sets the SURB store used by the encoder/decoder.
Sourcepub fn chain_api<Chain2>(
self,
chain_api: Chain2,
) -> HoprPacketPipelineBuilder<WIn, WOut, Chain2, S, TFact, AppOut, AppIn, TEvt>
pub fn chain_api<Chain2>( self, chain_api: Chain2, ) -> HoprPacketPipelineBuilder<WIn, WOut, Chain2, S, TFact, AppOut, AppIn, TEvt>
Sets the chain API used by the encoder/decoder and the unacknowledged ticket processor.
Sourcepub fn ticket_factory<TFact2>(
self,
ticket_factory: TFact2,
) -> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact2, AppOut, AppIn, TEvt>
pub fn ticket_factory<TFact2>( self, ticket_factory: TFact2, ) -> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact2, AppOut, AppIn, TEvt>
Sets the ticket factory used by the encoder/decoder.
Sourcepub fn with_ticket_events<TEvt2>(
self,
ticket_events: TEvt2,
) -> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt2>
pub fn with_ticket_events<TEvt2>( self, ticket_events: TEvt2, ) -> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt2>
Attaches the ticket events sink. Required for Relay nodes (see
HoprPacketPipelineBuilder::build_for_relay); ignored by Entry and Exit nodes.
Source§impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>where
WOut: Sink<(PeerId, Bytes)> + Clone + Unpin + Send + 'static,
WOut::Error: Error,
WIn: Stream<Item = (PeerId, Bytes)> + Send + 'static,
Chain: ChainKeyOperations + ChainReadChannelOperations + ChainReadTicketOperations + ChainValues + Clone + Send + Sync + 'static,
S: SurbStore + Clone + Send + Sync + 'static,
TFact: TicketFactory + Clone + Send + Sync + 'static,
AppOut: Sink<(HoprPseudonym, ApplicationDataIn)> + Send + 'static,
AppOut::Error: Error,
AppIn: Stream<Item = (ResolvedTransportRouting<HoprSurb>, ApplicationDataOut)> + Send + 'static,
impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>where
WOut: Sink<(PeerId, Bytes)> + Clone + Unpin + Send + 'static,
WOut::Error: Error,
WIn: Stream<Item = (PeerId, Bytes)> + Send + 'static,
Chain: ChainKeyOperations + ChainReadChannelOperations + ChainReadTicketOperations + ChainValues + Clone + Send + Sync + 'static,
S: SurbStore + Clone + Send + Sync + 'static,
TFact: TicketFactory + Clone + Send + Sync + 'static,
AppOut: Sink<(HoprPseudonym, ApplicationDataIn)> + Send + 'static,
AppOut::Error: Error,
AppIn: Stream<Item = (ResolvedTransportRouting<HoprSurb>, ApplicationDataOut)> + Send + 'static,
Sourcefn prepare(
self,
) -> (OffchainKeypair, (WOut, WIn), (AppOut, AppIn), PeerProtocolCounterRegistry, HoprUnacknowledgedTicketProcessor<Chain>, Option<TEvt>, HoprPacketPipelineConfig, AbortableList<HoprTransportProcess>, BuiltCodec<Chain, S, TFact>)
fn prepare( self, ) -> (OffchainKeypair, (WOut, WIn), (AppOut, AppIn), PeerProtocolCounterRegistry, HoprUnacknowledgedTicketProcessor<Chain>, Option<TEvt>, HoprPacketPipelineConfig, AbortableList<HoprTransportProcess>, BuiltCodec<Chain, S, TFact>)
Builds the codec pair (and capture wiring when enabled) and the unacknowledged ticket
processor, returning them together with an AbortableList already containing the
capture task if any was started.
Source§impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>where
WOut: Sink<(PeerId, Bytes)> + Clone + Unpin + Send + 'static,
WOut::Error: Error,
WIn: Stream<Item = (PeerId, Bytes)> + Send + 'static,
Chain: ChainKeyOperations + ChainReadChannelOperations + ChainReadTicketOperations + ChainValues + Clone + Send + Sync + 'static,
S: SurbStore + Clone + Send + Sync + 'static,
TEvt: Sink<TicketEvent> + Clone + Unpin + Send + 'static,
TEvt::Error: Error,
TFact: TicketFactory + Clone + Send + Sync + 'static,
AppOut: Sink<(HoprPseudonym, ApplicationDataIn)> + Send + 'static,
AppOut::Error: Error,
AppIn: Stream<Item = (ResolvedTransportRouting<HoprSurb>, ApplicationDataOut)> + Send + 'static,
impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>where
WOut: Sink<(PeerId, Bytes)> + Clone + Unpin + Send + 'static,
WOut::Error: Error,
WIn: Stream<Item = (PeerId, Bytes)> + Send + 'static,
Chain: ChainKeyOperations + ChainReadChannelOperations + ChainReadTicketOperations + ChainValues + Clone + Send + Sync + 'static,
S: SurbStore + Clone + Send + Sync + 'static,
TEvt: Sink<TicketEvent> + Clone + Unpin + Send + 'static,
TEvt::Error: Error,
TFact: TicketFactory + Clone + Send + Sync + 'static,
AppOut: Sink<(HoprPseudonym, ApplicationDataIn)> + Send + 'static,
AppOut::Error: Error,
AppIn: Stream<Item = (ResolvedTransportRouting<HoprSurb>, ApplicationDataOut)> + Send + 'static,
Sourcepub fn build_for_relay(self) -> AbortableList<HoprTransportProcess>
pub fn build_for_relay(self) -> AbortableList<HoprTransportProcess>
Builds the pipeline configured for a Relay node.
§Panics
Panics if HoprPacketPipelineBuilder::with_ticket_events was not called.
Source§impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>where
WOut: Sink<(PeerId, Bytes)> + Clone + Unpin + Send + 'static,
WOut::Error: Error,
WIn: Stream<Item = (PeerId, Bytes)> + Send + 'static,
Chain: ChainKeyOperations + ChainReadChannelOperations + ChainReadTicketOperations + ChainValues + Clone + Send + Sync + 'static,
S: SurbStore + Clone + Send + Sync + 'static,
TFact: TicketFactory + Clone + Send + Sync + 'static,
AppOut: Sink<(HoprPseudonym, ApplicationDataIn)> + Send + 'static,
AppOut::Error: Error,
AppIn: Stream<Item = (ResolvedTransportRouting<HoprSurb>, ApplicationDataOut)> + Send + 'static,
impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt> HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>where
WOut: Sink<(PeerId, Bytes)> + Clone + Unpin + Send + 'static,
WOut::Error: Error,
WIn: Stream<Item = (PeerId, Bytes)> + Send + 'static,
Chain: ChainKeyOperations + ChainReadChannelOperations + ChainReadTicketOperations + ChainValues + Clone + Send + Sync + 'static,
S: SurbStore + Clone + Send + Sync + 'static,
TFact: TicketFactory + Clone + Send + Sync + 'static,
AppOut: Sink<(HoprPseudonym, ApplicationDataIn)> + Send + 'static,
AppOut::Error: Error,
AppIn: Stream<Item = (ResolvedTransportRouting<HoprSurb>, ApplicationDataOut)> + Send + 'static,
Sourcepub fn build_for_entry(self) -> AbortableList<HoprTransportProcess>
pub fn build_for_entry(self) -> AbortableList<HoprTransportProcess>
Builds the pipeline configured for an Entry node.
The incoming acknowledgement pipeline is not started; ticket events (if any) are ignored.
Sourcepub fn build_for_exit(self) -> AbortableList<HoprTransportProcess>
pub fn build_for_exit(self) -> AbortableList<HoprTransportProcess>
Builds the pipeline configured for an Exit node.
The incoming acknowledgement pipeline is started but its acknowledgements are drained (never forwarded to a ticket processor); ticket events (if any) are ignored.
Trait Implementations§
Auto Trait Implementations§
impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt> Freeze for HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>
impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt = Drain<TicketEvent>> !RefUnwindSafe for HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>
impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt> Send for HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>
impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt> Sync for HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>
impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt> Unpin for HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>
impl<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt = Drain<TicketEvent>> !UnwindSafe for HoprPacketPipelineBuilder<WIn, WOut, Chain, S, TFact, AppOut, AppIn, TEvt>
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
§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,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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§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) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
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) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
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)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.