pub struct EventKey {
pub semantic: Key,
pub physical: Key,
pub mods: KeyMods,
pub state: KeyState,
}event only.Expand description
๐ซ ๐ฎ Represents a keyboard event.
๐ ui/event
๐ฆ size_of::<EventKey>() == 20 bytes / 160 bits
โ๏ธOption<T>
See also EventKeyFfi.
Fieldsยง
ยงsemantic: KeyThe key representing the human-readable code.
This corresponds to X11โs keysym.
physical: KeyThe key representing the hardware scan code.
This corresponds to X11โs scancode XKB mapped.
mods: KeyModsThe active modifiers of the key (e.g., Shift, Ctrl).
state: KeyStateThe state of the key (pressed or released).
Implementationsยง
Sourceยงimpl EventKey
impl EventKey
Sourcepub const fn to_ffi(&self) -> EventKeyFfi
Available on ffiยทยท only.
pub const fn to_ffi(&self) -> EventKeyFfi
ffiยทยท only.Converts EventKey to EventKeyFfi.
Sourcepub const fn from_ffi(from: &EventKeyFfi) -> EventKey
Available on ffiยทยท only.
pub const fn from_ffi(from: &EventKeyFfi) -> EventKey
ffiยทยท only.Converts EventKeyFfi to EventKey.
Sourceยงimpl EventKey
impl EventKey
Sourcepub const fn new(
semantic: Key,
physical: Key,
mods: KeyMods,
state: KeyState,
) -> Self
pub const fn new( semantic: Key, physical: Key, mods: KeyMods, state: KeyState, ) -> Self
Creates a key event from fully specified fields.
Sourcepub const fn press(key: Key) -> Self
pub const fn press(key: Key) -> Self
Creates a key press whose semantic and physical keys are the same.
Sourcepub const fn modified_press(key: Key, mods: KeyMods) -> Self
pub const fn modified_press(key: Key, mods: KeyMods) -> Self
Creates a modified key press whose semantic and physical keys are the same.
Sourcepub const fn text(c: char) -> Self
pub const fn text(c: char) -> Self
Creates a text-producing key press with unknown physical origin.
Sourcepub const fn modified_text(c: char, mods: KeyMods) -> Self
pub const fn modified_text(c: char, mods: KeyMods) -> Self
Creates a modified text-producing key press with unknown physical origin.
Sourcepub const fn with_state(self, state: KeyState) -> Self
pub const fn with_state(self, state: KeyState) -> Self
Returns this key event with a different state.
Trait Implementationsยง
impl Copy for EventKey
impl Eq for EventKey
Sourceยงimpl From<&EventKey> for EventKeyFfi
Available on ffiยทยท only.
impl From<&EventKey> for EventKeyFfi
ffiยทยท only.Sourceยงimpl From<&EventKeyFfi> for EventKey
Available on ffiยทยท only.
impl From<&EventKeyFfi> for EventKey
ffiยทยท only.Sourceยงfn from(e: &EventKeyFfi) -> Self
fn from(e: &EventKeyFfi) -> Self
Sourceยงimpl From<EventKey> for EventKeyFfi
Available on ffiยทยท only.
impl From<EventKey> for EventKeyFfi
ffiยทยท only.Sourceยงimpl From<EventKeyFfi> for EventKey
Available on ffiยทยท only.
impl From<EventKeyFfi> for EventKey
ffiยทยท only.Sourceยงfn from(e: EventKeyFfi) -> Self
fn from(e: EventKeyFfi) -> Self
Sourceยงimpl PartialEq for EventKey
impl PartialEq for EventKey
impl StructuralPartialEq for EventKey
Auto Trait Implementationsยง
impl Freeze for EventKey
impl RefUnwindSafe for EventKey
impl Send for EventKey
impl Sync for EventKey
impl Unpin for EventKey
impl UnsafeUnpin for EventKey
impl UnwindSafe for EventKey
Blanket Implementationsยง
Sourceยงimpl<T> AnyExt for T
impl<T> AnyExt for T
Sourceยงfn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId of Self using a custom hasher.Sourceยงfn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Sourceยงfn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
alloc only.Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Sourceยงimpl<T> ByteSized for T
impl<T> ByteSized for T
Sourceยงconst BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Sourceยงfn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Sourceยงfn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Sourceยงimpl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Sourceยงconst NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Sourceยงfn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Sourceยงfn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Sourceยงfn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Sourceยงfn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Sourceยงfn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true if dropping values of this type matters. Read moreSourceยงfn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self without running its destructor. Read moreSourceยงfn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงunsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงunsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงfn mem_as_bytes(&self) -> &[u8] โ
fn mem_as_bytes(&self) -> &[u8] โ
unsafe_slice only.