From 329dc7d7ec7ea6d6225ce9327f68a2441fe2923b Mon Sep 17 00:00:00 2001 From: Jos Ahrens Date: Sun, 9 Feb 2025 18:14:39 +0100 Subject: [PATCH] Improve documentation for `Rich::on_link_click` --- widget/src/text/rich.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/widget/src/text/rich.rs b/widget/src/text/rich.rs index adf87e2e..5bada7f2 100644 --- a/widget/src/text/rich.rs +++ b/widget/src/text/rich.rs @@ -133,11 +133,15 @@ where /// Sets the message that will be produced when a link of the [`Rich`] text /// is clicked. + /// + /// If the spans of the [`Rich`] text contain no links, you may need to call + /// this method with `on_link_click(never)` in order for the compiler to infer + /// the proper `Link` generic type. pub fn on_link_click( mut self, - on_link_clicked: impl Fn(Link) -> Message + 'a, + on_link_click: impl Fn(Link) -> Message + 'a, ) -> Self { - self.on_link_click = Some(Box::new(on_link_clicked)); + self.on_link_click = Some(Box::new(on_link_click)); self }