diff --git a/examples/all.rs b/examples/all.rs index 542bf32..42d94d6 100644 --- a/examples/all.rs +++ b/examples/all.rs @@ -90,13 +90,16 @@ impl App for ExampleApp { } if ui.button("Rich text").clicked() { - customize_toast(self.toasts.success( - egui::RichText::new(self.caption.clone()) - .color(Color32::GREEN) - .background_color(Color32::DARK_GRAY) - .size(self.font_size) - .italics() - .underline())); + customize_toast( + self.toasts.success( + egui::RichText::new(self.caption.clone()) + .color(Color32::GREEN) + .background_color(Color32::DARK_GRAY) + .size(self.font_size) + .italics() + .underline(), + ), + ); } if ui.button("Custom").clicked() { diff --git a/src/lib.rs b/src/lib.rs index 8bb6eef..346a267 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,11 +8,14 @@ pub use toast::*; mod anchor; pub use anchor::*; +use crate::ToastCaption::{Simple, WidgetText}; #[doc(hidden)] pub use egui::__run_test_ctx; -use egui::{vec2, Align, Color32, Context, FontId, FontSelection, Id, LayerId, Order, Rect, RichText, Rounding, Shadow, Stroke, TextWrapMode, Vec2}; use egui::text::TextWrapping; -use crate::ToastCaption::{Simple, WidgetText}; +use egui::{ + vec2, Align, Color32, Context, FontId, FontSelection, Id, LayerId, Order, Rect, RichText, + Rounding, Shadow, Stroke, TextWrapMode, Vec2, +}; pub(crate) const TOAST_WIDTH: f32 = 180.; pub(crate) const TOAST_HEIGHT: f32 = 34.; @@ -239,12 +242,11 @@ impl Toasts { let widget_text = match toast.caption { Simple(ref string) => egui::widget_text::WidgetText::from( - RichText::new(string).color(visuals.fg_stroke.color) + RichText::new(string).color(visuals.fg_stroke.color), ), - WidgetText(ref widget_text) => widget_text.to_owned() + WidgetText(ref widget_text) => widget_text.to_owned(), }; - let caption_galley = widget_text.into_galley_impl( ctx, ctx.style().as_ref(), diff --git a/src/toast.rs b/src/toast.rs index 15a2181..de5b67d 100644 --- a/src/toast.rs +++ b/src/toast.rs @@ -296,4 +296,4 @@ impl From for ToastCaption { fn from(text: RichText) -> Self { Self::WidgetText(text.into()) } -} \ No newline at end of file +}