Improve documentation for Rich::on_link_click
This commit is contained in:
parent
c12d59db4b
commit
329dc7d7ec
1 changed files with 6 additions and 2 deletions
|
|
@ -133,11 +133,15 @@ where
|
||||||
|
|
||||||
/// Sets the message that will be produced when a link of the [`Rich`] text
|
/// Sets the message that will be produced when a link of the [`Rich`] text
|
||||||
/// is clicked.
|
/// 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(
|
pub fn on_link_click(
|
||||||
mut self,
|
mut self,
|
||||||
on_link_clicked: impl Fn(Link) -> Message + 'a,
|
on_link_click: impl Fn(Link) -> Message + 'a,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.on_link_click = Some(Box::new(on_link_clicked));
|
self.on_link_click = Some(Box::new(on_link_click));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue