pub struct Response {
pub ctx: Context,
pub layer_id: LayerId,
pub id: Id,
pub rect: Rect,
pub sense: Sense,
/* private fields */
}
Expand description
The result of adding a widget to a Ui
.
A Response
lets you know whether or not a widget is being hovered, clicked or dragged.
It also lets you easily show a tooltip on hover.
Whenever something gets added to a Ui
, a Response
object is returned.
[ui.add
] returns a Response
, as does [ui.button
], and all similar shortcuts.
Fields§
§ctx: Context
Used for optionally showing a tooltip and checking for more interactions.
layer_id: LayerId
Which layer the widget is part of.
id: Id
The Id
of the widget/area this response pertains.
rect: Rect
The area of the screen we are talking about.
sense: Sense
The senses (click and/or drag) that the widget was interested in (if any).
Implementations§
§impl Response
impl Response
pub fn clicked(&self) -> bool
pub fn clicked(&self) -> bool
Returns true if this widget was clicked this frame by the primary button.
A click is registered when the mouse or touch is released within a certain amount of time and distance from when and where it was pressed.
Note that the widget must be sensing clicks with Sense::click
.
crate::Button
senses clicks; crate::Label
does not (unless you call crate::Label::sense
).
You can use Self::interact
to sense more things after adding a widget.
pub fn clicked_by(&self, button: PointerButton) -> bool
pub fn clicked_by(&self, button: PointerButton) -> bool
Returns true if this widget was clicked this frame by the given button.
pub fn secondary_clicked(&self) -> bool
pub fn secondary_clicked(&self) -> bool
Returns true if this widget was clicked this frame by the secondary mouse button (e.g. the right mouse button).
pub fn middle_clicked(&self) -> bool
pub fn middle_clicked(&self) -> bool
Returns true if this widget was clicked this frame by the middle mouse button.
pub fn double_clicked(&self) -> bool
pub fn double_clicked(&self) -> bool
Returns true if this widget was double-clicked this frame by the primary button.
pub fn triple_clicked(&self) -> bool
pub fn triple_clicked(&self) -> bool
Returns true if this widget was triple-clicked this frame by the primary button.
pub fn double_clicked_by(&self, button: PointerButton) -> bool
pub fn double_clicked_by(&self, button: PointerButton) -> bool
Returns true if this widget was double-clicked this frame by the given button.
pub fn triple_clicked_by(&self, button: PointerButton) -> bool
pub fn triple_clicked_by(&self, button: PointerButton) -> bool
Returns true if this widget was triple-clicked this frame by the given button.
pub fn clicked_elsewhere(&self) -> bool
pub fn clicked_elsewhere(&self) -> bool
true
if there was a click outside this widget this frame.
pub fn enabled(&self) -> bool
pub fn enabled(&self) -> bool
Was the widget enabled? If false, there was no interaction attempted and the widget should be drawn in a gray disabled look.
pub fn hovered(&self) -> bool
pub fn hovered(&self) -> bool
The pointer is hovering above this widget or the widget was clicked/tapped this frame.
Note that this is slightly different from checking response.rect.contains(pointer_pos)
.
For one, the hover rectangle is slightly larger, by half of the current item spacing
(to make it easier to click things). But hovered
also checks that no other area
is covering this response rectangle.
pub fn has_focus(&self) -> bool
pub fn has_focus(&self) -> bool
This widget has the keyboard focus (i.e. is receiving key presses).
This function only returns true if the UI as a whole (e.g. window) also has the keyboard focus. That makes this function suitable for style choices, e.g. a thicker border around focused widgets.
pub fn gained_focus(&self) -> bool
pub fn gained_focus(&self) -> bool
True if this widget has keyboard focus this frame, but didn’t last frame.
pub fn lost_focus(&self) -> bool
pub fn lost_focus(&self) -> bool
The widget had keyboard focus and lost it,
either because the user pressed tab or clicked somewhere else,
or (in case of a crate::TextEdit
) because the user pressed enter.
let response = ui.text_edit_singleline(&mut my_text);
if response.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter)) {
do_request(&my_text);
}
pub fn request_focus(&self)
pub fn request_focus(&self)
Request that this widget get keyboard focus.
pub fn surrender_focus(&self)
pub fn surrender_focus(&self)
Surrender keyboard focus for this widget.
pub fn dragged(&self) -> bool
pub fn dragged(&self) -> bool
The widgets is being dragged.
To find out which button(s), query crate::PointerState::button_down
(ui.input(|i| i.pointer.button_down(…))
).
Note that the widget must be sensing drags with Sense::drag
.
crate::DragValue
senses drags; crate::Label
does not (unless you call crate::Label::sense
).
You can use Self::interact
to sense more things after adding a widget.
pub fn dragged_by(&self, button: PointerButton) -> bool
pub fn drag_started(&self) -> bool
pub fn drag_started(&self) -> bool
Did a drag on this widgets begin this frame?
pub fn drag_started_by(&self, button: PointerButton) -> bool
pub fn drag_started_by(&self, button: PointerButton) -> bool
Did a drag on this widgets by the button begin this frame?
pub fn drag_released(&self) -> bool
pub fn drag_released(&self) -> bool
The widget was being dragged, but now it has been released.
pub fn drag_released_by(&self, button: PointerButton) -> bool
pub fn drag_released_by(&self, button: PointerButton) -> bool
The widget was being dragged by the button, but now it has been released.
pub fn drag_delta(&self) -> Vec2
pub fn drag_delta(&self) -> Vec2
If dragged, how many points were we dragged and in what direction?
pub fn interact_pointer_pos(&self) -> Option<Pos2>
pub fn interact_pointer_pos(&self) -> Option<Pos2>
Where the pointer (mouse/touch) were when when this widget was clicked or dragged.
None
if the widget is not being interacted with.
pub fn hover_pos(&self) -> Option<Pos2>
pub fn hover_pos(&self) -> Option<Pos2>
If it is a good idea to show a tooltip, where is pointer? None if the pointer is outside the response area.
Is the pointer button currently down on this widget? This is true if the pointer is pressing down or dragging a widget
pub fn changed(&self) -> bool
pub fn changed(&self) -> bool
What the underlying data changed?
e.g. the slider was dragged, text was entered in a TextEdit
etc.
Always false
for something like a Button
.
Can sometimes be true
even though the data didn’t changed
(e.g. if the user entered a character and erased it the same frame).
This is not set if the view of the data was changed.
For instance, moving the cursor in a TextEdit
does not set this to true
.
pub fn mark_changed(&mut self)
pub fn mark_changed(&mut self)
Report the data shown by this widget changed.
This must be called by widgets that represent some mutable data, e.g. checkboxes, sliders etc.
This should be called when the content changes, but not when the view does.
So we call this when the text of a crate::TextEdit
, but not when the cursors changes.
pub fn on_hover_ui(self, add_contents: impl FnOnce(&mut Ui)) -> Response
pub fn on_hover_ui(self, add_contents: impl FnOnce(&mut Ui)) -> Response
Show this UI if the widget was hovered (i.e. a tooltip).
The text will not be visible if the widget is not enabled.
For that, use Self::on_disabled_hover_ui
instead.
If you call this multiple times the tooltips will stack underneath the previous ones.
pub fn on_disabled_hover_ui(
self,
add_contents: impl FnOnce(&mut Ui),
) -> Response
pub fn on_disabled_hover_ui( self, add_contents: impl FnOnce(&mut Ui), ) -> Response
Show this UI when hovering if the widget is disabled.
pub fn on_hover_ui_at_pointer(
self,
add_contents: impl FnOnce(&mut Ui),
) -> Response
pub fn on_hover_ui_at_pointer( self, add_contents: impl FnOnce(&mut Ui), ) -> Response
Like on_hover_ui
, but show the ui next to cursor.
pub fn is_tooltip_open(&self) -> bool
pub fn is_tooltip_open(&self) -> bool
Was the tooltip open last frame?
pub fn on_hover_text_at_pointer(self, text: impl Into<WidgetText>) -> Response
pub fn on_hover_text_at_pointer(self, text: impl Into<WidgetText>) -> Response
Like on_hover_text
, but show the text next to cursor.
pub fn on_hover_text(self, text: impl Into<WidgetText>) -> Response
pub fn on_hover_text(self, text: impl Into<WidgetText>) -> Response
Show this text if the widget was hovered (i.e. a tooltip).
The text will not be visible if the widget is not enabled.
For that, use Self::on_disabled_hover_text
instead.
If you call this multiple times the tooltips will stack underneath the previous ones.
pub fn highlight(self) -> Response
pub fn highlight(self) -> Response
Highlight this widget, to make it look like it is hovered, even if it isn’t.
The highlight takes on frame to take effect if you call this after the widget has been fully rendered.
See also Context::highlight_widget
.
pub fn on_disabled_hover_text(self, text: impl Into<WidgetText>) -> Response
pub fn on_disabled_hover_text(self, text: impl Into<WidgetText>) -> Response
Show this text when hovering if the widget is disabled.
pub fn on_hover_cursor(self, cursor: CursorIcon) -> Response
pub fn on_hover_cursor(self, cursor: CursorIcon) -> Response
When hovered, use this icon for the mouse cursor.
pub fn on_hover_and_drag_cursor(self, cursor: CursorIcon) -> Response
pub fn on_hover_and_drag_cursor(self, cursor: CursorIcon) -> Response
When hovered or dragged, use this icon for the mouse cursor.
pub fn interact(&self, sense: Sense) -> Response
pub fn interact(&self, sense: Sense) -> Response
Check for more interactions (e.g. sense clicks on a Response
returned from a label).
Note that this call will not add any hover-effects to the widget, so when possible
it is better to give the widget a Sense
instead, e.g. using crate::Label::sense
.
let response = ui.label("hello");
assert!(!response.clicked()); // labels don't sense clicks by default
let response = response.interact(egui::Sense::click());
if response.clicked() { /* … */ }
pub fn scroll_to_me(&self, align: Option<Align>)
pub fn scroll_to_me(&self, align: Option<Align>)
Adjust the scroll position until this UI becomes visible.
If align
is None
, it’ll scroll enough to bring the UI into view.
See also: Ui::scroll_to_cursor
, Ui::scroll_to_rect
. Ui::scroll_with_delta
.
egui::ScrollArea::vertical().show(ui, |ui| {
for i in 0..1000 {
let response = ui.button("Scroll to me");
if response.clicked() {
response.scroll_to_me(Some(egui::Align::Center));
}
}
});
pub fn widget_info(&self, make_info: impl Fn() -> WidgetInfo)
pub fn widget_info(&self, make_info: impl Fn() -> WidgetInfo)
For accessibility.
Call after interacting and potential calls to Self::mark_changed
.
pub fn output_event(&self, event: OutputEvent)
pub fn labelled_by(self, id: Id) -> Response
pub fn labelled_by(self, id: Id) -> Response
Associate a label with a control for accessibility.
§Example
ui.horizontal(|ui| {
let label = ui.label("Your name: ");
ui.text_edit_singleline(&mut text).labelled_by(label.id);
});
Response to secondary clicks (right-clicks) by showing the given menu.
let response = ui.add(Label::new("Right-click me!").sense(Sense::click()));
response.context_menu(|ui| {
if ui.button("Close the menu").clicked() {
ui.close_menu();
}
});
See also: Ui::menu_button
and Ui::close_menu
.
§impl Response
impl Response
pub fn with_new_rect(self, rect: Rect) -> Response
pub fn with_new_rect(self, rect: Rect) -> Response
Returns a response with a modified Self::rect
.
Trait Implementations§
§impl BitOr for Response
impl BitOr for Response
To summarize the response from many widgets you can use this pattern:
use egui::*;
fn draw_vec2(ui: &mut Ui, v: &mut Vec2) -> Response {
ui.add(DragValue::new(&mut v.x)) | ui.add(DragValue::new(&mut v.y))
}
Now draw_vec2(ui, foo).hovered
is true if either DragValue
were hovered.
§impl BitOrAssign for Response
impl BitOrAssign for Response
To summarize the response from many widgets you can use this pattern:
let mut response = ui.add(widget_a);
response |= ui.add(widget_b);
response |= ui.add(widget_c);
if response.hovered() { ui.label("You hovered at least one of the widgets"); }
§fn bitor_assign(&mut self, rhs: Response)
fn bitor_assign(&mut self, rhs: Response)
|=
operation. Read more§impl EguiResponseExt for Response
impl EguiResponseExt for Response
§fn focus_by_default(self, ui: &mut Ui) -> Response
fn focus_by_default(self, ui: &mut Ui) -> Response
Auto Trait Implementations§
impl Freeze for Response
impl !RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl !UnwindSafe for Response
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist.§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,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync 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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.§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.