From d47315f084425a84e631985732f9b3f51e12c5f2 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 30 Sep 2024 10:01:31 +0200 Subject: [PATCH] Add doc-test of `with_layer_id` --- crates/egui/src/ui.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/egui/src/ui.rs b/crates/egui/src/ui.rs index 76cca78e67f3..6fdda922e52a 100644 --- a/crates/egui/src/ui.rs +++ b/crates/egui/src/ui.rs @@ -2260,6 +2260,15 @@ impl Ui { } /// Redirect shapes to another paint layer. + /// + /// ``` + /// # egui::__run_test_ui(|ui| { + /// let layer_id = LayerId::new(Order::Tooltip, id); + /// ui.with_layer_id(layer_id, |ui| { + /// ui.label("This is now in a different layer"); + /// }); + /// # }); + /// ``` pub fn with_layer_id( &mut self, layer_id: LayerId,