pub struct Event<'alloc> { /* private fields */ }Expand description
Keyboard input event containing information about the physical key pressed, modifiers, and generated text.
Implementations§
Source§impl<'alloc> Event<'alloc>
impl<'alloc> Event<'alloc>
Sourcepub fn new_with_alloc<'ctx: 'alloc, Ctx>(
alloc: &'alloc Allocator<'ctx, Ctx>,
) -> Result<Self>
pub fn new_with_alloc<'ctx: 'alloc, Ctx>( alloc: &'alloc Allocator<'ctx, Ctx>, ) -> Result<Self>
Create a new key event instance with a custom allocator.
See the crate-level documentation regarding custom memory management and lifetimes.
Sourcepub fn set_action(&mut self, action: Action) -> &mut Self
pub fn set_action(&mut self, action: Action) -> &mut Self
Set the key action (press, release, repeat).
Sourcepub fn set_consumed_mods(&mut self, mods: Mods) -> &mut Self
pub fn set_consumed_mods(&mut self, mods: Mods) -> &mut Self
Set the consumed modifiers bitmask.
Sourcepub fn consumed_mods(&self) -> Mods
pub fn consumed_mods(&self) -> Mods
Get the consumed modifiers bitmask.
Sourcepub fn set_composing(&mut self, composing: bool) -> &mut Self
pub fn set_composing(&mut self, composing: bool) -> &mut Self
Set whether the key event is part of a composition sequence.
Sourcepub fn is_composing(&self) -> bool
pub fn is_composing(&self) -> bool
Get whether the key event is part of a composition sequence.
Sourcepub fn set_utf8<S: Into<String>>(&mut self, text: Option<S>) -> &mut Self
pub fn set_utf8<S: Into<String>>(&mut self, text: Option<S>) -> &mut Self
Set the UTF-8 text generated by the key event.
The event makes an internal copy of the text since the C API may reuse it without any rigid lifetime guarantees.
Sourcepub fn set_unshifted_codepoint(&mut self, codepoint: char) -> &mut Self
pub fn set_unshifted_codepoint(&mut self, codepoint: char) -> &mut Self
Set the unshifted Unicode codepoint.
Sourcepub fn unshifted_codepoint(&self) -> char
pub fn unshifted_codepoint(&self) -> char
Get the unshifted Unicode codepoint.
Trait Implementations§
Auto Trait Implementations§
impl<'alloc> Freeze for Event<'alloc>
impl<'alloc> RefUnwindSafe for Event<'alloc>
impl<'alloc> !Send for Event<'alloc>
impl<'alloc> !Sync for Event<'alloc>
impl<'alloc> Unpin for Event<'alloc>
impl<'alloc> UnsafeUnpin for Event<'alloc>
impl<'alloc> UnwindSafe for Event<'alloc>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more