diff --git a/crates/egui/src/widget_text.rs b/crates/egui/src/widget_text.rs index 03b8cbb9751..80ee6f05124 100644 --- a/crates/egui/src/widget_text.rs +++ b/crates/egui/src/widget_text.rs @@ -67,6 +67,27 @@ impl From for RichText { } } +impl From<&Box> for RichText { + #[inline] + fn from(text: &Box) -> Self { + Self::new(text.clone()) + } +} + +impl From<&mut Box> for RichText { + #[inline] + fn from(text: &mut Box) -> Self { + Self::new(text.clone()) + } +} + +impl From> for RichText { + #[inline] + fn from(text: Box) -> Self { + Self::new(text) + } +} + impl From> for RichText { #[inline] fn from(text: Cow<'_, str>) -> Self { @@ -701,6 +722,20 @@ impl From for WidgetText { } } +impl From<&Box> for WidgetText { + #[inline] + fn from(text: &Box) -> Self { + Self::RichText(RichText::new(text.clone())) + } +} + +impl From> for WidgetText { + #[inline] + fn from(text: Box) -> Self { + Self::RichText(RichText::new(text)) + } +} + impl From> for WidgetText { #[inline] fn from(text: Cow<'_, str>) -> Self {