Skip to content

Commit

Permalink
Expose the Modifiers and Code on an Accelerator
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnfrishert committed Nov 5, 2024
1 parent cf9dcfa commit 44bf293
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/accelerator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Modifiers>, key: impl Borrow<Code>) -> bool {
// Should be a const but const bit_or doesn't work here.
Expand Down

0 comments on commit 44bf293

Please sign in to comment.