From ce3b89639d84a279bbc0f4dac912a136488d0bec Mon Sep 17 00:00:00 2001 From: "Ram.Type-0" Date: Mon, 1 Nov 2021 23:59:04 +0900 Subject: Take `Cow` in `Text::new` --- native/src/widget/tooltip.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'native/src/widget/tooltip.rs') 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, + 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>, - tooltip: impl ToString, + tooltip: impl Into>, position: Position, ) -> Self { Tooltip { content: content.into(), - tooltip: Text::new(tooltip.to_string()), + tooltip: Text::new(tooltip), position, gap: 0, padding: Self::DEFAULT_PADDING, -- cgit