From 44bf29355782b4c3191af4e96d26db211033e5c3 Mon Sep 17 00:00:00 2001 From: Stijn Frishert Date: Tue, 5 Nov 2024 12:02:42 +0100 Subject: [PATCH] Expose the Modifiers and Code on an Accelerator --- src/accelerator.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/accelerator.rs b/src/accelerator.rs index 7f614f18..614a6f61 100644 --- a/src/accelerator.rs +++ b/src/accelerator.rs @@ -98,6 +98,16 @@ impl Accelerator { self.id } + /// Returns the modifier for this accelerator + pub fn modifiers(&self) -> &Modifiers { + &self.mods + } + + /// Returns the code for this accelerator + pub fn key(&self) -> &Code { + &self.key + } + /// Returns `true` if this [`Code`] and [`Modifiers`] matches this `Accelerator`. pub fn matches(&self, modifiers: impl Borrow, key: impl Borrow) -> bool { // Should be a const but const bit_or doesn't work here.