From 99a904112ca111f2ab0e60e30b6c369741b1653b Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 2 Apr 2024 10:08:10 +0200 Subject: Implement `IntoFragment` for `Fragment` --- core/src/widget/text.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'core/src') diff --git a/core/src/widget/text.rs b/core/src/widget/text.rs index 53591e41..f1f0b345 100644 --- a/core/src/widget/text.rs +++ b/core/src/widget/text.rs @@ -379,6 +379,18 @@ pub trait IntoFragment<'a> { fn into_fragment(self) -> Fragment<'a>; } +impl<'a> IntoFragment<'a> for Fragment<'a> { + fn into_fragment(self) -> Fragment<'a> { + self + } +} + +impl<'a, 'b> IntoFragment<'a> for &'a Fragment<'b> { + fn into_fragment(self) -> Fragment<'a> { + Fragment::Borrowed(self) + } +} + impl<'a> IntoFragment<'a> for &'a str { fn into_fragment(self) -> Fragment<'a> { Fragment::Borrowed(self) -- cgit