#[non_exhaustive]pub enum UiEvent {
Resize(u32, u32),
CloseRequested,
KeyPress(String),
Mouse {
x: f32,
y: f32,
},
MouseDown {
button: MouseButton,
x: f32,
y: f32,
modifiers: Modifiers,
},
MouseUp {
button: MouseButton,
x: f32,
y: f32,
modifiers: Modifiers,
},
MouseMove {
x: f32,
y: f32,
},
Wheel(ScrollDelta),
KeyDown {
key: Key,
modifiers: Modifiers,
repeat: bool,
},
KeyUp {
key: Key,
modifiers: Modifiers,
},
ImePreedit {
text: String,
cursor: Option<(usize, usize)>,
},
ImeCommit(String),
}Expand description
Events that the UI backend can emit.
This enum is #[non_exhaustive] — match arms must include a catch-all
(_ => {}) to remain forward-compatible as new variants are added.
When deserialising with serde (feature = "serde"), unknown variants will
produce a serde error. This is intentional: the API contract only promises
forward-compatibility at the Rust source level via the #[non_exhaustive]
catch-all; JSON consumers must handle new variants themselves.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Resize(u32, u32)
The window was resized to the given pixel dimensions.
CloseRequested
The user requested the window to close.
KeyPress(String)
A keyboard key was pressed (key name / character string).
Mouse
Mouse cursor position.
MouseDown
A mouse button was pressed at the given position.
Fields
Which button was pressed.
MouseUp
A mouse button was released at the given position.
Fields
Which button was released.
MouseMove
The mouse moved to a new position (no button-state change implied).
Wheel(ScrollDelta)
A scroll-wheel / trackpad scroll occurred.
KeyDown
A key was pressed (or auto-repeated).
Fields
KeyUp
A key was released.
ImePreedit
IME preedit — composition in progress.
text is the current composition string. cursor is the byte-offset
range (start, end) within text that should be highlighted as the
cursor/selection; None means no explicit cursor hint.
Note: on the egui forwarding path the cursor range is forwarded as
of egui 0.35+ — it is converted from this byte-offset range into the
char-offset egui::ImeEvent::Preedit::active_range_chars range (egui
0.34 and earlier accepted only a bare String, so the cursor hint was
dropped there).
Fields
ImeCommit(String)
IME commit — final committed text after composition ends.
Callers should insert text into the active text-input field.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UiEvent
impl RefUnwindSafe for UiEvent
impl Send for UiEvent
impl Sync for UiEvent
impl Unpin for UiEvent
impl UnsafeUnpin for UiEvent
impl UnwindSafe for UiEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more