Skip to content

Commit

Permalink
Add doc-test example for Modifiers::matches
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed May 22, 2023
1 parent 7583a44 commit 6a80e6f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/egui/src/data/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 6a80e6f

Please sign in to comment.