From 6a80e6fc741d3d7ec14cc5174aca39230c76634b Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 22 May 2023 21:35:30 +0200 Subject: [PATCH] Add doc-test example for Modifiers::matches --- crates/egui/src/data/input.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/egui/src/data/input.rs b/crates/egui/src/data/input.rs index 2be1e157..6fd20efa 100644 --- a/crates/egui/src/data/input.rs +++ b/crates/egui/src/data/input.rs @@ -466,6 +466,16 @@ impl Modifiers { /// Check for equality but with proper handling of [`Self::command`]. /// + /// # Example: + /// ``` + /// # use egui::Modifiers; + /// # let current_modifiers = Modifiers::default(); + /// if current_modifiers.matches(Modifiers::ALT | Modifiers::SHIFT) { + /// // Alt and Shift are pressed, and nothing else + /// } + /// ``` + /// + /// ## Behavior: /// ``` /// # use egui::Modifiers; /// assert!(Modifiers::CTRL.matches(Modifiers::CTRL));