From 4d2eb5b71eda7baa80776bbb47a81d701ebc007d Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 25 Apr 2022 22:01:32 +0200 Subject: [PATCH] Don't export macros that should only be pub(crate) --- egui-winit/src/lib.rs | 6 ++---- egui_demo_lib/src/apps/color_test.rs | 2 +- egui_demo_lib/src/apps/demo/code_editor.rs | 2 +- egui_demo_lib/src/apps/demo/code_example.rs | 2 +- egui_demo_lib/src/apps/demo/context_menu.rs | 2 +- egui_demo_lib/src/apps/demo/dancing_strings.rs | 2 +- egui_demo_lib/src/apps/demo/drag_and_drop.rs | 2 +- egui_demo_lib/src/apps/demo/font_book.rs | 2 +- egui_demo_lib/src/apps/demo/misc_demo_window.rs | 4 ++-- egui_demo_lib/src/apps/demo/multi_touch.rs | 2 +- egui_demo_lib/src/apps/demo/paint_bezier.rs | 2 +- egui_demo_lib/src/apps/demo/painting.rs | 2 +- egui_demo_lib/src/apps/demo/plot_demo.rs | 2 +- egui_demo_lib/src/apps/demo/scrolling.rs | 2 +- egui_demo_lib/src/apps/demo/sliders.rs | 2 +- egui_demo_lib/src/apps/demo/strip_demo.rs | 2 +- egui_demo_lib/src/apps/demo/table_demo.rs | 2 +- egui_demo_lib/src/apps/demo/tests.rs | 10 +++++----- egui_demo_lib/src/apps/demo/widget_gallery.rs | 2 +- egui_demo_lib/src/apps/demo/window_options.rs | 2 +- egui_demo_lib/src/apps/fractal_clock.rs | 2 +- egui_demo_lib/src/apps/http_app.rs | 2 +- egui_demo_lib/src/easy_mark/easy_mark_editor.rs | 2 +- egui_demo_lib/src/lib.rs | 14 ++++++-------- egui_extras/src/lib.rs | 6 ++---- egui_glow/src/lib.rs | 6 ++---- 26 files changed, 39 insertions(+), 47 deletions(-) diff --git a/egui-winit/src/lib.rs b/egui-winit/src/lib.rs index 651aba6e..e2f35a90 100644 --- a/egui-winit/src/lib.rs +++ b/egui-winit/src/lib.rs @@ -663,21 +663,19 @@ fn translate_cursor(cursor_icon: egui::CursorIcon) -> Option { #[cfg(feature = "puffin")] puffin::profile_function!($($arg)*); }; } +pub(crate) use profile_function; /// Profiling macro for feature "puffin" -#[doc(hidden)] -#[macro_export] macro_rules! profile_scope { ($($arg: tt)*) => { #[cfg(feature = "puffin")] puffin::profile_scope!($($arg)*); }; } +pub(crate) use profile_scope; diff --git a/egui_demo_lib/src/apps/color_test.rs b/egui_demo_lib/src/apps/color_test.rs index e8f1fc64..4e05b27c 100644 --- a/egui_demo_lib/src/apps/color_test.rs +++ b/egui_demo_lib/src/apps/color_test.rs @@ -50,7 +50,7 @@ impl ColorTest { ui.set_max_width(680.0); ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); ui.label("This is made to test that the egui painter backend is set up correctly, so that all colors are interpolated and blended in linear space with premultiplied alpha."); diff --git a/egui_demo_lib/src/apps/demo/code_editor.rs b/egui_demo_lib/src/apps/demo/code_editor.rs index 5c75baf3..2b0041a6 100644 --- a/egui_demo_lib/src/apps/demo/code_editor.rs +++ b/egui_demo_lib/src/apps/demo/code_editor.rs @@ -42,7 +42,7 @@ impl super::View for CodeEditor { ui.horizontal(|ui| { ui.set_height(0.0); ui.label("An example of syntax highlighting in a TextEdit."); - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); if cfg!(feature = "syntect") { diff --git a/egui_demo_lib/src/apps/demo/code_example.rs b/egui_demo_lib/src/apps/demo/code_example.rs index 2047fa19..70da1806 100644 --- a/egui_demo_lib/src/apps/demo/code_example.rs +++ b/egui_demo_lib/src/apps/demo/code_example.rs @@ -84,7 +84,7 @@ impl super::View for CodeExample { use crate::syntax_highlighting::code_view_ui; ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); code_view_ui( diff --git a/egui_demo_lib/src/apps/demo/context_menu.rs b/egui_demo_lib/src/apps/demo/context_menu.rs index 9bd6f2dd..e0458853 100644 --- a/egui_demo_lib/src/apps/demo/context_menu.rs +++ b/egui_demo_lib/src/apps/demo/context_menu.rs @@ -109,7 +109,7 @@ impl super::View for ContextMenus { }); }); ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); } } diff --git a/egui_demo_lib/src/apps/demo/dancing_strings.rs b/egui_demo_lib/src/apps/demo/dancing_strings.rs index 07c6968f..f89bbb35 100644 --- a/egui_demo_lib/src/apps/demo/dancing_strings.rs +++ b/egui_demo_lib/src/apps/demo/dancing_strings.rs @@ -61,7 +61,7 @@ impl super::View for DancingStrings { ui.painter().extend(shapes); }); ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); } } diff --git a/egui_demo_lib/src/apps/demo/drag_and_drop.rs b/egui_demo_lib/src/apps/demo/drag_and_drop.rs index 0070be35..556a3805 100644 --- a/egui_demo_lib/src/apps/demo/drag_and_drop.rs +++ b/egui_demo_lib/src/apps/demo/drag_and_drop.rs @@ -170,7 +170,7 @@ impl super::View for DragAndDropDemo { } ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); } } diff --git a/egui_demo_lib/src/apps/demo/font_book.rs b/egui_demo_lib/src/apps/demo/font_book.rs index b4265467..8d23b294 100644 --- a/egui_demo_lib/src/apps/demo/font_book.rs +++ b/egui_demo_lib/src/apps/demo/font_book.rs @@ -32,7 +32,7 @@ impl super::Demo for FontBook { impl super::View for FontBook { fn ui(&mut self, ui: &mut egui::Ui) { ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); ui.label(format!( diff --git a/egui_demo_lib/src/apps/demo/misc_demo_window.rs b/egui_demo_lib/src/apps/demo/misc_demo_window.rs index f05eda14..fc5ff9b0 100644 --- a/egui_demo_lib/src/apps/demo/misc_demo_window.rs +++ b/egui_demo_lib/src/apps/demo/misc_demo_window.rs @@ -177,7 +177,7 @@ impl Widgets { pub fn ui(&mut self, ui: &mut Ui) { let Self { angle, password } = self; ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file_line!()); + ui.add(crate::egui_github_link_file_line!()); }); ui.horizontal_wrapped(|ui| { @@ -628,6 +628,6 @@ fn text_layout_ui( ui.label(job); ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file_line!()); + ui.add(crate::egui_github_link_file_line!()); }); } diff --git a/egui_demo_lib/src/apps/demo/multi_touch.rs b/egui_demo_lib/src/apps/demo/multi_touch.rs index c67ad521..92ff2ce4 100644 --- a/egui_demo_lib/src/apps/demo/multi_touch.rs +++ b/egui_demo_lib/src/apps/demo/multi_touch.rs @@ -41,7 +41,7 @@ impl super::Demo for MultiTouch { impl super::View for MultiTouch { fn ui(&mut self, ui: &mut egui::Ui) { ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); ui.strong( "This demo only works on devices with multitouch support (e.g. mobiles and tablets).", diff --git a/egui_demo_lib/src/apps/demo/paint_bezier.rs b/egui_demo_lib/src/apps/demo/paint_bezier.rs index cf1a0bd2..4cbd56da 100644 --- a/egui_demo_lib/src/apps/demo/paint_bezier.rs +++ b/egui_demo_lib/src/apps/demo/paint_bezier.rs @@ -160,7 +160,7 @@ impl super::Demo for PaintBezier { impl super::View for PaintBezier { fn ui(&mut self, ui: &mut Ui) { ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); self.ui_control(ui); diff --git a/egui_demo_lib/src/apps/demo/painting.rs b/egui_demo_lib/src/apps/demo/painting.rs index 33b66591..b9dbbeae 100644 --- a/egui_demo_lib/src/apps/demo/painting.rs +++ b/egui_demo_lib/src/apps/demo/painting.rs @@ -87,7 +87,7 @@ impl super::Demo for Painting { impl super::View for Painting { fn ui(&mut self, ui: &mut Ui) { ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); self.ui_control(ui); ui.label("Paint with your mouse/touch!"); diff --git a/egui_demo_lib/src/apps/demo/plot_demo.rs b/egui_demo_lib/src/apps/demo/plot_demo.rs index 9fbac26b..4101aaa1 100644 --- a/egui_demo_lib/src/apps/demo/plot_demo.rs +++ b/egui_demo_lib/src/apps/demo/plot_demo.rs @@ -871,7 +871,7 @@ impl super::View for PlotDemo { ui.label("Zoom with ctrl + scroll."); } ui.label("Reset view with double-click."); - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); }); ui.separator(); diff --git a/egui_demo_lib/src/apps/demo/scrolling.rs b/egui_demo_lib/src/apps/demo/scrolling.rs index d806d516..62aba735 100644 --- a/egui_demo_lib/src/apps/demo/scrolling.rs +++ b/egui_demo_lib/src/apps/demo/scrolling.rs @@ -251,7 +251,7 @@ impl super::View for ScrollTo { ui.separator(); ui.vertical_centered(|ui| { egui::reset_button(ui, self); - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); } } diff --git a/egui_demo_lib/src/apps/demo/sliders.rs b/egui_demo_lib/src/apps/demo/sliders.rs index 12405b9b..2b1bbd5b 100644 --- a/egui_demo_lib/src/apps/demo/sliders.rs +++ b/egui_demo_lib/src/apps/demo/sliders.rs @@ -176,7 +176,7 @@ impl super::View for Sliders { ui.vertical_centered(|ui| { egui::reset_button(ui, self); - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); } } diff --git a/egui_demo_lib/src/apps/demo/strip_demo.rs b/egui_demo_lib/src/apps/demo/strip_demo.rs index ebaeb2b2..576f02a1 100644 --- a/egui_demo_lib/src/apps/demo/strip_demo.rs +++ b/egui_demo_lib/src/apps/demo/strip_demo.rs @@ -99,7 +99,7 @@ impl super::View for StripDemo { }); strip.cell(|ui| { ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); }); }); diff --git a/egui_demo_lib/src/apps/demo/table_demo.rs b/egui_demo_lib/src/apps/demo/table_demo.rs index 854888c9..7e0cb0ba 100644 --- a/egui_demo_lib/src/apps/demo/table_demo.rs +++ b/egui_demo_lib/src/apps/demo/table_demo.rs @@ -81,7 +81,7 @@ impl super::View for TableDemo { }); strip.cell(|ui| { ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); }); }); diff --git a/egui_demo_lib/src/apps/demo/tests.rs b/egui_demo_lib/src/apps/demo/tests.rs index d5d6d799..94cd3667 100644 --- a/egui_demo_lib/src/apps/demo/tests.rs +++ b/egui_demo_lib/src/apps/demo/tests.rs @@ -23,7 +23,7 @@ impl super::View for CursorTest { .button(format!("{:?}", cursor_icon)) .on_hover_cursor(cursor_icon); } - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); } } @@ -77,7 +77,7 @@ impl super::View for IdTest { let _ = ui.button("Button"); ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); } } @@ -157,7 +157,7 @@ impl super::View for ManualLayoutTest { let widget_rect = egui::Rect::from_min_size(ui.min_rect().min + *widget_offset, *widget_size); - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); // Showing how to place a widget anywhere in the [`Ui`]: match *widget_type { @@ -296,7 +296,7 @@ impl super::View for TableTest { ui.vertical_centered(|ui| { egui::reset_button(ui, self); - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); } } @@ -328,7 +328,7 @@ impl super::Demo for InputTest { impl super::View for InputTest { fn ui(&mut self, ui: &mut egui::Ui) { ui.vertical_centered(|ui| { - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); let response = ui.add( diff --git a/egui_demo_lib/src/apps/demo/widget_gallery.rs b/egui_demo_lib/src/apps/demo/widget_gallery.rs index e99b0801..fb7f8b2a 100644 --- a/egui_demo_lib/src/apps/demo/widget_gallery.rs +++ b/egui_demo_lib/src/apps/demo/widget_gallery.rs @@ -91,7 +91,7 @@ impl super::View for WidgetGallery { ui.vertical_centered(|ui| { let tooltip_text = "The full egui documentation.\nYou can also click the different widgets names in the left column."; ui.hyperlink("https://docs.rs/egui/").on_hover_text(tooltip_text); - ui.add(crate::__egui_github_link_file!( + ui.add(crate::egui_github_link_file!( "Source code of the widget gallery" )); }); diff --git a/egui_demo_lib/src/apps/demo/window_options.rs b/egui_demo_lib/src/apps/demo/window_options.rs index 557155c5..5d54f250 100644 --- a/egui_demo_lib/src/apps/demo/window_options.rs +++ b/egui_demo_lib/src/apps/demo/window_options.rs @@ -135,7 +135,7 @@ impl super::View for WindowOptions { self.disabled_time = ui.input().time; } egui::reset_button(ui, self); - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); }); } } diff --git a/egui_demo_lib/src/apps/fractal_clock.rs b/egui_demo_lib/src/apps/fractal_clock.rs index 854df99d..eedb9d03 100644 --- a/egui_demo_lib/src/apps/fractal_clock.rs +++ b/egui_demo_lib/src/apps/fractal_clock.rs @@ -93,7 +93,7 @@ impl FractalClock { "Inspired by a screensaver by Rob Mayoff", "http://www.dqd.com/~mayoff/programs/FractalClock/", ); - ui.add(crate::__egui_github_link_file!()); + ui.add(crate::egui_github_link_file!()); } fn paint(&mut self, painter: &Painter) { diff --git a/egui_demo_lib/src/apps/http_app.rs b/egui_demo_lib/src/apps/http_app.rs index fe2cd426..e858ae49 100644 --- a/egui_demo_lib/src/apps/http_app.rs +++ b/egui_demo_lib/src/apps/http_app.rs @@ -58,7 +58,7 @@ impl epi::App for HttpApp { egui::TopBottomPanel::bottom("http_bottom").show(ctx, |ui| { let layout = egui::Layout::top_down(egui::Align::Center).with_main_justify(true); ui.allocate_ui_with_layout(ui.available_size(), layout, |ui| { - ui.add(crate::__egui_github_link_file!()) + ui.add(crate::egui_github_link_file!()) }) }); diff --git a/egui_demo_lib/src/easy_mark/easy_mark_editor.rs b/egui_demo_lib/src/easy_mark/easy_mark_editor.rs index 262f1eb0..63957f15 100644 --- a/egui_demo_lib/src/easy_mark/easy_mark_editor.rs +++ b/egui_demo_lib/src/easy_mark/easy_mark_editor.rs @@ -34,7 +34,7 @@ impl epi::App for EasyMarkEditor { egui::TopBottomPanel::bottom("easy_mark_bottom").show(ctx, |ui| { let layout = egui::Layout::top_down(egui::Align::Center).with_main_justify(true); ui.allocate_ui_with_layout(ui.available_size(), layout, |ui| { - ui.add(crate::__egui_github_link_file!()) + ui.add(crate::egui_github_link_file!()) }) }); diff --git a/egui_demo_lib/src/lib.rs b/egui_demo_lib/src/lib.rs index fcb16c2f..90f542ee 100644 --- a/egui_demo_lib/src/lib.rs +++ b/egui_demo_lib/src/lib.rs @@ -19,11 +19,9 @@ pub use wrap_app::WrapApp; // ---------------------------------------------------------------------------- /// Create a [`Hyperlink`](crate::Hyperlink) to this egui source code file on github. -#[doc(hidden)] -#[macro_export] -macro_rules! __egui_github_link_file { +macro_rules! egui_github_link_file { () => { - crate::__egui_github_link_file!("(source code)") + crate::egui_github_link_file!("(source code)") }; ($label: expr) => { egui::github_link_file!( @@ -32,13 +30,12 @@ macro_rules! __egui_github_link_file { ) }; } +pub(crate) use egui_github_link_file; /// Create a [`Hyperlink`](crate::Hyperlink) to this egui source code file and line on github. -#[doc(hidden)] -#[macro_export] -macro_rules! __egui_github_link_file_line { +macro_rules! egui_github_link_file_line { () => { - crate::__egui_github_link_file_line!("(source code)") + crate::egui_github_link_file_line!("(source code)") }; ($label: expr) => { egui::github_link_file_line!( @@ -47,6 +44,7 @@ macro_rules! __egui_github_link_file_line { ) }; } +pub(crate) use egui_github_link_file_line; // ---------------------------------------------------------------------------- diff --git a/egui_extras/src/lib.rs b/egui_extras/src/lib.rs index a88c7e30..30745306 100644 --- a/egui_extras/src/lib.rs +++ b/egui_extras/src/lib.rs @@ -22,8 +22,6 @@ pub use crate::strip::*; pub use crate::table::*; /// Log an error with either `tracing` or `eprintln` -#[doc(hidden)] -#[macro_export] macro_rules! log_err { ($fmt: literal, $($arg: tt)*) => {{ #[cfg(feature = "tracing")] @@ -35,10 +33,9 @@ macro_rules! log_err { ); }}; } +pub(crate) use log_err; /// Panic in debug builds, log otherwise. -#[doc(hidden)] -#[macro_export] macro_rules! log_or_panic { ($fmt: literal, $($arg: tt)*) => {{ if cfg!(debug_assertions) { @@ -48,3 +45,4 @@ macro_rules! log_or_panic { } }}; } +pub(crate) use log_or_panic; diff --git a/egui_glow/src/lib.rs b/egui_glow/src/lib.rs index 94d155af..c9dd3b4d 100644 --- a/egui_glow/src/lib.rs +++ b/egui_glow/src/lib.rs @@ -89,21 +89,19 @@ pub fn check_for_gl_error_impl(gl: &glow::Context, file: &str, line: u32, contex // --------------------------------------------------------------------------- /// Profiling macro for feature "puffin" -#[doc(hidden)] -#[macro_export] macro_rules! profile_function { ($($arg: tt)*) => { #[cfg(feature = "puffin")] puffin::profile_function!($($arg)*); }; } +pub(crate) use profile_function; /// Profiling macro for feature "puffin" -#[doc(hidden)] -#[macro_export] macro_rules! profile_scope { ($($arg: tt)*) => { #[cfg(feature = "puffin")] puffin::profile_scope!($($arg)*); }; } +pub(crate) use profile_scope;