Add doc-test example for Modifiers::matches

This commit is contained in:
Emil Ernerfeldt 2023-05-22 21:35:30 +02:00
parent 7583a44e32
commit 6a80e6fc74
1 changed files with 10 additions and 0 deletions

View File

@ -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));