diff options
author | 2021-11-01 23:59:04 +0900 | |
---|---|---|
committer | 2022-09-21 20:59:17 +0200 | |
commit | ce3b89639d84a279bbc0f4dac912a136488d0bec (patch) | |
tree | eaf073565e9c02eae8e013a5c59c26558aa13ba6 /native/src/widget/tooltip.rs | |
parent | f15bc3ca34cadb114f678cb2430209c474149b45 (diff) | |
download | iced-ce3b89639d84a279bbc0f4dac912a136488d0bec.tar.gz iced-ce3b89639d84a279bbc0f4dac912a136488d0bec.tar.bz2 iced-ce3b89639d84a279bbc0f4dac912a136488d0bec.zip |
Take `Cow` in `Text::new`
Diffstat (limited to 'native/src/widget/tooltip.rs')
-rw-r--r-- | native/src/widget/tooltip.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/native/src/widget/tooltip.rs b/native/src/widget/tooltip.rs index 7ce2aaae..674f2ba6 100644 --- a/native/src/widget/tooltip.rs +++ b/native/src/widget/tooltip.rs @@ -13,6 +13,8 @@ use crate::{ Shell, Size, Vector, Widget, }; +use std::borrow::Cow; + /// An element to display a widget over another. #[allow(missing_debug_implementations)] pub struct Tooltip<'a, Message, Renderer: text::Renderer> @@ -21,7 +23,7 @@ where Renderer::Theme: container::StyleSheet + widget::text::StyleSheet, { content: Element<'a, Message, Renderer>, - tooltip: Text<Renderer>, + tooltip: Text<'a, Renderer>, position: Position, gap: u16, padding: u16, @@ -42,12 +44,12 @@ where /// [`Tooltip`]: struct.Tooltip.html pub fn new( content: impl Into<Element<'a, Message, Renderer>>, - tooltip: impl ToString, + tooltip: impl Into<Cow<'a, str>>, position: Position, ) -> Self { Tooltip { content: content.into(), - tooltip: Text::new(tooltip.to_string()), + tooltip: Text::new(tooltip), position, gap: 0, padding: Self::DEFAULT_PADDING, |