Don't export macros that should only be pub(crate)

This commit is contained in:
Emil Ernerfeldt 2022-04-25 22:01:32 +02:00
parent 95c0174331
commit 4d2eb5b71e
26 changed files with 39 additions and 47 deletions

View file

@ -663,21 +663,19 @@ fn translate_cursor(cursor_icon: egui::CursorIcon) -> Option<winit::window::Curs
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// Profiling macro for feature "puffin" /// Profiling macro for feature "puffin"
#[doc(hidden)]
#[macro_export]
macro_rules! profile_function { macro_rules! profile_function {
($($arg: tt)*) => { ($($arg: tt)*) => {
#[cfg(feature = "puffin")] #[cfg(feature = "puffin")]
puffin::profile_function!($($arg)*); puffin::profile_function!($($arg)*);
}; };
} }
pub(crate) use profile_function;
/// Profiling macro for feature "puffin" /// Profiling macro for feature "puffin"
#[doc(hidden)]
#[macro_export]
macro_rules! profile_scope { macro_rules! profile_scope {
($($arg: tt)*) => { ($($arg: tt)*) => {
#[cfg(feature = "puffin")] #[cfg(feature = "puffin")]
puffin::profile_scope!($($arg)*); puffin::profile_scope!($($arg)*);
}; };
} }
pub(crate) use profile_scope;

View file

@ -50,7 +50,7 @@ impl ColorTest {
ui.set_max_width(680.0); ui.set_max_width(680.0);
ui.vertical_centered(|ui| { 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."); 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.");

View file

@ -42,7 +42,7 @@ impl super::View for CodeEditor {
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.set_height(0.0); ui.set_height(0.0);
ui.label("An example of syntax highlighting in a TextEdit."); 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") { if cfg!(feature = "syntect") {

View file

@ -84,7 +84,7 @@ impl super::View for CodeExample {
use crate::syntax_highlighting::code_view_ui; use crate::syntax_highlighting::code_view_ui;
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
code_view_ui( code_view_ui(

View file

@ -109,7 +109,7 @@ impl super::View for ContextMenus {
}); });
}); });
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
} }
} }

View file

@ -61,7 +61,7 @@ impl super::View for DancingStrings {
ui.painter().extend(shapes); ui.painter().extend(shapes);
}); });
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
} }
} }

View file

@ -170,7 +170,7 @@ impl super::View for DragAndDropDemo {
} }
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
} }
} }

View file

@ -32,7 +32,7 @@ impl super::Demo for FontBook {
impl super::View for FontBook { impl super::View for FontBook {
fn ui(&mut self, ui: &mut egui::Ui) { fn ui(&mut self, ui: &mut egui::Ui) {
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
ui.label(format!( ui.label(format!(

View file

@ -177,7 +177,7 @@ impl Widgets {
pub fn ui(&mut self, ui: &mut Ui) { pub fn ui(&mut self, ui: &mut Ui) {
let Self { angle, password } = self; let Self { angle, password } = self;
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file_line!()); ui.add(crate::egui_github_link_file_line!());
}); });
ui.horizontal_wrapped(|ui| { ui.horizontal_wrapped(|ui| {
@ -628,6 +628,6 @@ fn text_layout_ui(
ui.label(job); ui.label(job);
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file_line!()); ui.add(crate::egui_github_link_file_line!());
}); });
} }

View file

@ -41,7 +41,7 @@ impl super::Demo for MultiTouch {
impl super::View for MultiTouch { impl super::View for MultiTouch {
fn ui(&mut self, ui: &mut egui::Ui) { fn ui(&mut self, ui: &mut egui::Ui) {
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
ui.strong( ui.strong(
"This demo only works on devices with multitouch support (e.g. mobiles and tablets).", "This demo only works on devices with multitouch support (e.g. mobiles and tablets).",

View file

@ -160,7 +160,7 @@ impl super::Demo for PaintBezier {
impl super::View for PaintBezier { impl super::View for PaintBezier {
fn ui(&mut self, ui: &mut Ui) { fn ui(&mut self, ui: &mut Ui) {
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
self.ui_control(ui); self.ui_control(ui);

View file

@ -87,7 +87,7 @@ impl super::Demo for Painting {
impl super::View for Painting { impl super::View for Painting {
fn ui(&mut self, ui: &mut Ui) { fn ui(&mut self, ui: &mut Ui) {
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
self.ui_control(ui); self.ui_control(ui);
ui.label("Paint with your mouse/touch!"); ui.label("Paint with your mouse/touch!");

View file

@ -871,7 +871,7 @@ impl super::View for PlotDemo {
ui.label("Zoom with ctrl + scroll."); ui.label("Zoom with ctrl + scroll.");
} }
ui.label("Reset view with double-click."); ui.label("Reset view with double-click.");
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
}); });
ui.separator(); ui.separator();

View file

@ -251,7 +251,7 @@ impl super::View for ScrollTo {
ui.separator(); ui.separator();
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
egui::reset_button(ui, self); egui::reset_button(ui, self);
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
} }
} }

View file

@ -176,7 +176,7 @@ impl super::View for Sliders {
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
egui::reset_button(ui, self); egui::reset_button(ui, self);
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
} }
} }

View file

@ -99,7 +99,7 @@ impl super::View for StripDemo {
}); });
strip.cell(|ui| { strip.cell(|ui| {
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
}); });
}); });

View file

@ -81,7 +81,7 @@ impl super::View for TableDemo {
}); });
strip.cell(|ui| { strip.cell(|ui| {
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
}); });
}); });

View file

@ -23,7 +23,7 @@ impl super::View for CursorTest {
.button(format!("{:?}", cursor_icon)) .button(format!("{:?}", cursor_icon))
.on_hover_cursor(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"); let _ = ui.button("Button");
ui.vertical_centered(|ui| { 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 = let widget_rect =
egui::Rect::from_min_size(ui.min_rect().min + *widget_offset, *widget_size); 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`]: // Showing how to place a widget anywhere in the [`Ui`]:
match *widget_type { match *widget_type {
@ -296,7 +296,7 @@ impl super::View for TableTest {
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
egui::reset_button(ui, self); 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 { impl super::View for InputTest {
fn ui(&mut self, ui: &mut egui::Ui) { fn ui(&mut self, ui: &mut egui::Ui) {
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
let response = ui.add( let response = ui.add(

View file

@ -91,7 +91,7 @@ impl super::View for WidgetGallery {
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
let tooltip_text = "The full egui documentation.\nYou can also click the different widgets names in the left column."; 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.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" "Source code of the widget gallery"
)); ));
}); });

View file

@ -135,7 +135,7 @@ impl super::View for WindowOptions {
self.disabled_time = ui.input().time; self.disabled_time = ui.input().time;
} }
egui::reset_button(ui, self); egui::reset_button(ui, self);
ui.add(crate::__egui_github_link_file!()); ui.add(crate::egui_github_link_file!());
}); });
} }
} }

View file

@ -93,7 +93,7 @@ impl FractalClock {
"Inspired by a screensaver by Rob Mayoff", "Inspired by a screensaver by Rob Mayoff",
"http://www.dqd.com/~mayoff/programs/FractalClock/", "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) { fn paint(&mut self, painter: &Painter) {

View file

@ -58,7 +58,7 @@ impl epi::App for HttpApp {
egui::TopBottomPanel::bottom("http_bottom").show(ctx, |ui| { egui::TopBottomPanel::bottom("http_bottom").show(ctx, |ui| {
let layout = egui::Layout::top_down(egui::Align::Center).with_main_justify(true); let layout = egui::Layout::top_down(egui::Align::Center).with_main_justify(true);
ui.allocate_ui_with_layout(ui.available_size(), layout, |ui| { ui.allocate_ui_with_layout(ui.available_size(), layout, |ui| {
ui.add(crate::__egui_github_link_file!()) ui.add(crate::egui_github_link_file!())
}) })
}); });

View file

@ -34,7 +34,7 @@ impl epi::App for EasyMarkEditor {
egui::TopBottomPanel::bottom("easy_mark_bottom").show(ctx, |ui| { egui::TopBottomPanel::bottom("easy_mark_bottom").show(ctx, |ui| {
let layout = egui::Layout::top_down(egui::Align::Center).with_main_justify(true); let layout = egui::Layout::top_down(egui::Align::Center).with_main_justify(true);
ui.allocate_ui_with_layout(ui.available_size(), layout, |ui| { ui.allocate_ui_with_layout(ui.available_size(), layout, |ui| {
ui.add(crate::__egui_github_link_file!()) ui.add(crate::egui_github_link_file!())
}) })
}); });

View file

@ -19,11 +19,9 @@ pub use wrap_app::WrapApp;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/// Create a [`Hyperlink`](crate::Hyperlink) to this egui source code file on github. /// Create a [`Hyperlink`](crate::Hyperlink) to this egui source code file on github.
#[doc(hidden)] macro_rules! egui_github_link_file {
#[macro_export]
macro_rules! __egui_github_link_file {
() => { () => {
crate::__egui_github_link_file!("(source code)") crate::egui_github_link_file!("(source code)")
}; };
($label: expr) => { ($label: expr) => {
egui::github_link_file!( 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. /// Create a [`Hyperlink`](crate::Hyperlink) to this egui source code file and line on github.
#[doc(hidden)] macro_rules! egui_github_link_file_line {
#[macro_export]
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) => { ($label: expr) => {
egui::github_link_file_line!( egui::github_link_file_line!(
@ -47,6 +44,7 @@ macro_rules! __egui_github_link_file_line {
) )
}; };
} }
pub(crate) use egui_github_link_file_line;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View file

@ -22,8 +22,6 @@ pub use crate::strip::*;
pub use crate::table::*; pub use crate::table::*;
/// Log an error with either `tracing` or `eprintln` /// Log an error with either `tracing` or `eprintln`
#[doc(hidden)]
#[macro_export]
macro_rules! log_err { macro_rules! log_err {
($fmt: literal, $($arg: tt)*) => {{ ($fmt: literal, $($arg: tt)*) => {{
#[cfg(feature = "tracing")] #[cfg(feature = "tracing")]
@ -35,10 +33,9 @@ macro_rules! log_err {
); );
}}; }};
} }
pub(crate) use log_err;
/// Panic in debug builds, log otherwise. /// Panic in debug builds, log otherwise.
#[doc(hidden)]
#[macro_export]
macro_rules! log_or_panic { macro_rules! log_or_panic {
($fmt: literal, $($arg: tt)*) => {{ ($fmt: literal, $($arg: tt)*) => {{
if cfg!(debug_assertions) { if cfg!(debug_assertions) {
@ -48,3 +45,4 @@ macro_rules! log_or_panic {
} }
}}; }};
} }
pub(crate) use log_or_panic;

View file

@ -89,21 +89,19 @@ pub fn check_for_gl_error_impl(gl: &glow::Context, file: &str, line: u32, contex
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// Profiling macro for feature "puffin" /// Profiling macro for feature "puffin"
#[doc(hidden)]
#[macro_export]
macro_rules! profile_function { macro_rules! profile_function {
($($arg: tt)*) => { ($($arg: tt)*) => {
#[cfg(feature = "puffin")] #[cfg(feature = "puffin")]
puffin::profile_function!($($arg)*); puffin::profile_function!($($arg)*);
}; };
} }
pub(crate) use profile_function;
/// Profiling macro for feature "puffin" /// Profiling macro for feature "puffin"
#[doc(hidden)]
#[macro_export]
macro_rules! profile_scope { macro_rules! profile_scope {
($($arg: tt)*) => { ($($arg: tt)*) => {
#[cfg(feature = "puffin")] #[cfg(feature = "puffin")]
puffin::profile_scope!($($arg)*); puffin::profile_scope!($($arg)*);
}; };
} }
pub(crate) use profile_scope;