Display all platform-specific documentation on docs.rs (#3076)

This commit is contained in:
Mads Marquart 2024-01-04 12:54:35 +01:00 committed by GitHub
parent 8b3de7cedf
commit 42dbc4748e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 810 additions and 814 deletions

View file

@ -1,5 +1,4 @@
#![cfg(any(windows_platform, macos_platform, x11_platform, wayland_platform))]
use crate::event::KeyEvent;
use crate::keyboard::Key;
/// Additional methods for the `KeyEvent` which cannot be implemented on all
@ -22,3 +21,18 @@ pub trait KeyEventExtModifierSupplement {
/// cannot be `Dead`.
fn key_without_modifiers(&self) -> Key;
}
impl KeyEventExtModifierSupplement for KeyEvent {
#[inline]
fn text_with_all_modifiers(&self) -> Option<&str> {
self.platform_specific
.text_with_all_modifiers
.as_ref()
.map(|s| s.as_str())
}
#[inline]
fn key_without_modifiers(&self) -> Key {
self.platform_specific.key_without_modifiers.clone()
}
}